Page 1 of 1

Hyperlink into a button

Posted: Tue Nov 18, 2008 8:57 am
by ekix
Hello guys

I'd like to add a button like "Visit my homepage" into a PB application and when someone clicks this button, it should open the default browser, and go to my web page.

I did not find this kind of example here, neither in the PB help

Could someone help me a bit.

Thanks/
Ekix

Posted: Tue Nov 18, 2008 9:37 am
by chi
like this?

Code: Select all

Global Window_0, Button_0

Procedure Open_Window_0()
  
  Window_0 = OpenWindow(#PB_Any, 0, 0, 200, 70, "ButtonUrl Demo", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered)
  If Window_0
    If CreateGadgetList(WindowID(Window_0))
      Button_0 = ButtonGadget(#PB_Any, 10, 10, 180, 50, "visit my homepage")
    EndIf
  EndIf
EndProcedure

Open_Window_0()

Repeat
  Event = WaitWindowEvent()
  If Event = #PB_Event_Gadget
    Select EventGadget()
      Case Button_0
        RunProgram("http://www.google.com")
    EndSelect
  EndIf
Until Event = #PB_Event_CloseWindow
End

Re: Hyperlink into a button

Posted: Tue Nov 18, 2008 9:37 am
by PB
Why is your sig promoting the sale of cannabis?

Thanks

Posted: Tue Nov 18, 2008 10:13 am
by ekix
It works now as below

Code: Select all

 
If GadgetID = #Button_Home
     RunProgram("http://www.ekisoft.com")
EndIf
Ps. I did change my signature, look's like it's not popular here :=)