Page 1 of 1

HyperLinkGadgets don't wrap

Posted: Fri Sep 26, 2008 11:47 am
by PB
HyperLinkGadgets don't wrap their text (see below). Is that a bug? If not, I hereby request it. ;)

Code: Select all

If OpenWindow(0,200,200,300,100,"HyperLink",#PB_Window_SystemMenu)
  t$="Click here to visit the web site of MyApp"
  HyperLinkGadget(0,20,20,100,100,t$,RGB(255,0,0),#PB_HyperLink_Underline)
  Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf

Posted: Fri Sep 26, 2008 1:22 pm
by akj
PB says:
Is that a bug? If not, I hereby request it.
Why on earth do you wish to request a bug?

Posted: Fri Sep 26, 2008 1:48 pm
by PB
> Why on earth do you wish to request a bug?

I'm requesting that it wraps the text, if it's not a bug for not already doing it. :lol:

Posted: Sat Sep 27, 2008 2:23 am
by Rescator
I don't think they are supposed to wrap,
for example a button does not wrap nor does an image :)
I can't recall ever seeing a API/GUI hyper text link wrapping.
If it does then it's probably custom behavior done by .NET or it's a browser :)

Posted: Sat Sep 27, 2008 3:38 am
by PB
Well I thought that because it's basically a clickable TextGadget, then it should
be able to wrap like a TextGadget does. But it doesn't. I guess I could always
use a blue-colored TextGadget, but that doesn't show the hand cursor. :(
Perhaps there's an API call to make HyperLinkGadgets wrappable?

Posted: Sat Sep 27, 2008 3:49 am
by Mistrel
The reason it doesn't wrap around, I think, it because it's a single-line and there is no break for it to wrap. Try putting a space in it and see if that works.

Posted: Sat Sep 27, 2008 6:24 am
by PB
Um, my example has no less than 8 spaces in it. ;)

Posted: Sun Sep 28, 2008 8:00 pm
by Rescator
If you just want the hand effect this might work on Windows.

Code: Select all

  If OpenWindow(1, 0, 0, 270, 160, "HyperlinkGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ;And CreateGadgetList(WindowID(0)) ;Only needed for PB4.20 and older.

     hCursor1 = LoadCursor_(#Null, #IDC_HAND)
     hCursor2=LoadCursor_(#Null, #IDC_ARROW)
     SetClassLong_(WindowID(1),#GCL_HCURSOR,hCursor1)
    Repeat
     event=WindowEvent()
    Until event = #PB_Event_CloseWindow
    SetClassLong_(WindowID(1),#GCL_HCURSOR,hCursor2)
    Delay(3000)
  EndIf
If you replace WindowID() with GadgetID() it should work on gadgets as well, but not all gadgets may actually work. (no change of pointer)

Posted: Tue Mar 17, 2009 5:04 pm
by mesozorn
If I try this on a TextGadget, it ends up changing the pointer for ALL TextGadgets, not just the one I specified. What am I doing wrong? See below:

Code: Select all

OpenWindow(1, 0, 0, 270, 460, "HyperlinkGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ;And CreateGadgetList(WindowID(0)) ;Only needed for PB4.20 and older. 
   TextGadget(2,50,50,50,50,"hello",#SS_NOTIFY)
   TextGadget(3,100,100,50,50,"hello",#SS_NOTIFY)
   TextGadget(4,200,200,50,50,"hello",#SS_NOTIFY)
   
   hCursor1 = LoadCursor_(#Null, #IDC_HAND) 
   SetClassLong_(GadgetID(3),#GCL_HCURSOR,hCursor1)

Repeat 
    event=WindowEvent() 
    Until event = #PB_Event_CloseWindow 

Posted: Tue Mar 17, 2009 6:28 pm
by Demivec
mesozorn wrote:If I try this on a TextGadget, it ends up changing the pointer for ALL TextGadgets, not just the one I specified. What am I doing wrong? See below:

Code: Select all

OpenWindow(1, 0, 0, 270, 460, "HyperlinkGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ;And CreateGadgetList(WindowID(0)) ;Only needed for PB4.20 and older. 
   TextGadget(2,50,50,50,50,"hello",#SS_NOTIFY)
   TextGadget(3,100,100,50,50,"hello",#SS_NOTIFY)
   TextGadget(4,200,200,50,50,"hello",#SS_NOTIFY)
   
   hCursor1 = LoadCursor_(#Null, #IDC_HAND) 
   SetClassLong_(GadgetID(3),#GCL_HCURSOR,hCursor1)

Repeat 
    event=WindowEvent() 
    Until event = #PB_Event_CloseWindow 
You're changing the values for the Class (i.e. "Text Gadgets") and not for a single gadget window. Use SetWindowLong() or SetWindowLongPtr() instead to changed the values for one Gadget.