Page 2 of 2

Posted: Sat Sep 07, 2002 3:57 pm
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

Posted: Sat Sep 07, 2002 4:44 pm
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