HyperlinkGadget issue

Just starting out? Need help? Post your questions and find answers here.
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

HyperlinkGadget issue

Post by kpeters58 »

In my code below, the hyperlinkgadget is non-responsive (no event reaction, no color change on mouse over). What am I missing?

Code: Select all

Define Link

Procedure LinkClicked()
  Debug "Clicked"
EndProcedure

If OpenWindow(CurWindow, #PB_Ignore, #PB_Ignore, 450, 320, "About", #PB_Window_ScreenCentered|#PB_Window_SystemMenu, 0)
  StickyWindow(CurWindow, #True)
  FrameGadget(#PB_Any, 10, 10, 430, 290, "Version Info")
  ;     
  ;ImageGadget(#PB_Any, 30, 30, 64, 64, ImageID(#CompanyLogo))
  ;
  SetGadgetFont(TextGadget(#PB_Any, 110, 50, 200, 25, "Product Name"), LoadFont(1, "Arial", 14, #PB_Font_Bold)) 
  SetGadgetFont(TextGadget(#PB_Any, 110, 80, 280, 25, "Product Info goes here"), LoadFont(1, "Arial", 11, #PB_Font_Bold))  
  ;
  ; shadow rectangle first 
  SetGadgetColor(ContainerGadget(#PB_Any, 50, 120, 370, 140, #PB_Container_Flat), #PB_Gadget_BackColor, #Gray): CloseGadgetList()
  ;
  ; white rect next - overlapping the shadow rectangle
  SetGadgetColor(ContainerGadget(#PB_Any, 45, 115, 370, 140, #PB_Container_Flat), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  20, 310, 25, "Company Name"), #PB_Gadget_BackColor, #White)
    Link = HyperLinkGadget(#PB_Any, 30, 110, 310, 25, "Company URL", #Blue, #PB_HyperLink_Underline)
    SetGadgetColor(Link, #PB_Gadget_BackColor, #White)
    BindGadgetEvent(Link, @LinkClicked())
    SetGadgetColor(TextGadget(#PB_Any, 30,  50, 310, 25, "Copyright goes here"), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  80, 310, 25, "Version: " + "Product version here"), #PB_Gadget_BackColor, #White)
  CloseGadgetList() ; for white container gadget
  ;    
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
PB 5.73 on Windows 10 & OS X High Sierra
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: HyperlinkGadget issue

Post by RASHAD »

I prefer #2
The first Container steal the mouse movement you must disable it first

#1 :

Code: Select all

Define Link

Procedure LinkClicked()
  Debug "Clicked"
EndProcedure

If OpenWindow(CurWindow, #PB_Ignore, #PB_Ignore, 450, 320, "About", #PB_Window_ScreenCentered|#PB_Window_SystemMenu, 0)
  StickyWindow(CurWindow, #True)
  FrameGadget(#PB_Any, 10, 10, 430, 290, "Version Info")
  ;     
  ;ImageGadget(#PB_Any, 30, 30, 64, 64, ImageID(#CompanyLogo))
  ;
  SetGadgetFont(TextGadget(#PB_Any, 110, 50, 200, 25, "Product Name"), LoadFont(1, "Arial", 14, #PB_Font_Bold))
  SetGadgetFont(TextGadget(#PB_Any, 110, 80, 280, 25, "Product Info goes here"), LoadFont(1, "Arial", 11, #PB_Font_Bold)) 
  ;
  ; shadow rectangle first
  cont1 = ContainerGadget(#PB_Any, 50, 120, 370, 140, #PB_Container_Flat)
  SetGadgetColor(cont1, #PB_Gadget_BackColor, #Gray)
  CloseGadgetList()
  DisableGadget(cont1,1)
  ; white rect next - overlapping the shadow rectangle
  SetGadgetColor(ContainerGadget(#PB_Any, 45, 115, 370, 140, #PB_Container_Flat), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  20, 310, 25, "Company Name"), #PB_Gadget_BackColor, #White)
    Link = HyperLinkGadget(#PB_Any, 30, 110, 310, 25, "Company URL", #Blue, #PB_HyperLink_Underline)
    SetGadgetColor(Link, #PB_Gadget_BackColor, #White)
    BindGadgetEvent(Link, @LinkClicked())
    SetGadgetColor(TextGadget(#PB_Any, 30,  50, 310, 25, "Copyright goes here"), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  80, 310, 25, "Version: " + "Product version here"), #PB_Gadget_BackColor, #White)
  CloseGadgetList() ; for white container gadget
  ;   
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
#2 :

Code: Select all

Define Link

Procedure LinkClicked()
  Debug "Clicked"
EndProcedure

If OpenWindow(CurWindow, #PB_Ignore, #PB_Ignore, 450, 320, "About", #PB_Window_ScreenCentered|#PB_Window_SystemMenu, 0)
  StickyWindow(CurWindow, #True)
  FrameGadget(#PB_Any, 10, 10, 430, 290, "Version Info")
  ;
  SetGadgetFont(TextGadget(#PB_Any, 110, 50, 200, 25, "Product Name"), LoadFont(1, "Arial", 14, #PB_Font_Bold))
  SetGadgetFont(TextGadget(#PB_Any, 110, 80, 280, 25, "Product Info goes here"), LoadFont(1, "Arial", 11, #PB_Font_Bold)) 
  
  SetGadgetColor(TextGadget(#PB_Any, 50, 120, 370, 140, ""), #PB_Gadget_BackColor, #Gray)
  SetGadgetColor(ContainerGadget(#PB_Any, 45, 115, 370, 140, #PB_Container_Flat), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  20, 310, 25, "Company Name"), #PB_Gadget_BackColor, #White)
    Link = HyperLinkGadget(#PB_Any, 30, 110, 310, 25, "Company URL", #Blue, #PB_HyperLink_Underline)
    SetGadgetColor(Link, #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  50, 310, 25, "Copyright goes here"), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  80, 310, 25, "Version: " + "Product version here"), #PB_Gadget_BackColor, #White)
  CloseGadgetList() ; for white container gadget 
   
  BindGadgetEvent(Link, @LinkClicked())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Last edited by RASHAD on Sun Jan 14, 2018 10:52 am, edited 1 time in total.
Egypt my love
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

Re: HyperlinkGadget issue

Post by kpeters58 »

Thanks much!

RASHAD wrote:I prefer #2
The first Container steel the mouse movement you must disable it first

#1 :

Code: Select all

Define Link

Procedure LinkClicked()
  Debug "Clicked"
EndProcedure

If OpenWindow(CurWindow, #PB_Ignore, #PB_Ignore, 450, 320, "About", #PB_Window_ScreenCentered|#PB_Window_SystemMenu, 0)
  StickyWindow(CurWindow, #True)
  FrameGadget(#PB_Any, 10, 10, 430, 290, "Version Info")
  ;     
  ;ImageGadget(#PB_Any, 30, 30, 64, 64, ImageID(#CompanyLogo))
  ;
  SetGadgetFont(TextGadget(#PB_Any, 110, 50, 200, 25, "Product Name"), LoadFont(1, "Arial", 14, #PB_Font_Bold))
  SetGadgetFont(TextGadget(#PB_Any, 110, 80, 280, 25, "Product Info goes here"), LoadFont(1, "Arial", 11, #PB_Font_Bold)) 
  ;
  ; shadow rectangle first
  cont1 = ContainerGadget(#PB_Any, 50, 120, 370, 140, #PB_Container_Flat)
  SetGadgetColor(cont1, #PB_Gadget_BackColor, #Gray)
  CloseGadgetList()
  DisableGadget(cont1,1)
  ; white rect next - overlapping the shadow rectangle
  SetGadgetColor(ContainerGadget(#PB_Any, 45, 115, 370, 140, #PB_Container_Flat), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  20, 310, 25, "Company Name"), #PB_Gadget_BackColor, #White)
    Link = HyperLinkGadget(#PB_Any, 30, 110, 310, 25, "Company URL", #Blue, #PB_HyperLink_Underline)
    SetGadgetColor(Link, #PB_Gadget_BackColor, #White)
    BindGadgetEvent(Link, @LinkClicked())
    SetGadgetColor(TextGadget(#PB_Any, 30,  50, 310, 25, "Copyright goes here"), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  80, 310, 25, "Version: " + "Product version here"), #PB_Gadget_BackColor, #White)
  CloseGadgetList() ; for white container gadget
  ;   
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
#2 :

Code: Select all

Define Link

Procedure LinkClicked()
  Debug "Clicked"
EndProcedure

If OpenWindow(CurWindow, #PB_Ignore, #PB_Ignore, 450, 320, "About", #PB_Window_ScreenCentered|#PB_Window_SystemMenu, 0)
  StickyWindow(CurWindow, #True)
  FrameGadget(#PB_Any, 10, 10, 430, 290, "Version Info")
  ;
  SetGadgetFont(TextGadget(#PB_Any, 110, 50, 200, 25, "Product Name"), LoadFont(1, "Arial", 14, #PB_Font_Bold))
  SetGadgetFont(TextGadget(#PB_Any, 110, 80, 280, 25, "Product Info goes here"), LoadFont(1, "Arial", 11, #PB_Font_Bold)) 
  
  SetGadgetColor(TextGadget(#PB_Any, 50, 120, 370, 140, ""), #PB_Gadget_BackColor, #Gray)
  SetGadgetColor(ContainerGadget(#PB_Any, 45, 115, 370, 140, #PB_Container_Flat), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  20, 310, 25, "Company Name"), #PB_Gadget_BackColor, #White)
    Link = HyperLinkGadget(#PB_Any, 30, 110, 310, 25, "Company URL", #Blue, #PB_HyperLink_Underline)
    SetGadgetColor(Link, #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  50, 310, 25, "Copyright goes here"), #PB_Gadget_BackColor, #White)
    SetGadgetColor(TextGadget(#PB_Any, 30,  80, 310, 25, "Version: " + "Product version here"), #PB_Gadget_BackColor, #White)
  CloseGadgetList() ; for white container gadget 
   
  BindGadgetEvent(Link, @LinkClicked())
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
PB 5.73 on Windows 10 & OS X High Sierra
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4663
Joined: Sun Apr 12, 2009 6:27 am

Re: HyperlinkGadget issue

Post by RASHAD »

You are welcome :)
Egypt my love
Post Reply