HyperLinkGadgets don't wrap

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

HyperLinkGadgets don't wrap

Post 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
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post by akj »

PB says:
Is that a bug? If not, I hereby request it.
Why on earth do you wish to request a bug?
Anthony Jordan
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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:
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post 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 :)
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post 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?
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

Um, my example has no less than 8 spaces in it. ;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post 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)
mesozorn
Enthusiast
Enthusiast
Posts: 171
Joined: Fri Feb 20, 2009 2:23 am

Post 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 
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post 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.
Post Reply