Hyperlink control?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by horst.

Danilo,
after studying your code (thanks!!) I made a stripped-down version
that only shows a hand cursor on a regular button:

Code: Select all

; Hand Cursor Button Test  

hWindow = OpenWindow(0,200,200,200,200,#PB_Window_SystemMenu,"Hand Cursor Test") 
CreateGadgetList(WindowID()) 
hButton = ButtonGadget(0,10,10,80,25,"Hand Test")
SetClassLong_(hButton,#GCL_HCURSOR,0)
handcursor = LoadCursor_(0, 32649) ; #IDC_HAND

Procedure HandMouse()
  Shared handcursor,hWindow,hButton 
  If ChildWindowFromPoint_(hWindow,WindowMouseX(),WindowMouseY()-20) = hButton
    normalcursor = SetCursor_(handcursor) 
  Else 
    If normalcursor : SetCursor_(normalcursor) : normalcursor = 0 : EndIf
  EndIf  
EndProcedure

Repeat
  Event = WaitWindowEvent() 
  If Event = #PB_EventCloseWindow : done = 1  
  ElseIf Event = #WM_MOUSEMOVE : HandMouse() 
  EndIf 
Until done 
End 

Horst
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by horst.

Correction: normalcursor must be shared to make sense.
But actually the normal cursor is restored by Windows anyhow (somehow), so you can drop that part:

Code: Select all

Procedure HandMouse()
  Shared handcursor,hWindow,hButton 
  If ChildWindowFromPoint_(hWindow,WindowMouseX(),WindowMouseY()-20) = hButton
    SetCursor_(handcursor) 
  EndIf  
EndProcedure

Horst
Post Reply