Code: Alles auswählen
; PB 4.xx
; By DerProgger
EnableExplicit
Global Event.l
Procedure GetMouseOverGadget(Window.l)
Protected MousePos.POINT, Handle.l
GetCursorPos_(@MousePos)
Handle = WindowFromPoint_(MousePos\x,MousePos\y)
If Handle <> WindowID(Window)
ProcedureReturn GetDlgCtrlID_(Handle)
Else
ProcedureReturn -1
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ButtonGadget(0, 10, 10, 200, 20, "Standard Button")
ButtonGadget(1, 10, 40, 200, 20, "Left Button", #PB_Button_Left)
ButtonGadget(2, 10, 70, 200, 20, "Right Button", #PB_Button_Right)
ButtonGadget(3, 10,100, 200, 60, "Multiline Button (längerer Text wird automatisch umgebrochen)", #PB_Button_MultiLine)
ButtonGadget(4, 10,170, 200, 20, "Toggle Button", #PB_Button_Toggle)
Repeat
Event = WaitWindowEvent()
If Event = #WM_MOUSEMOVE
Debug GetMouseOverGadget(0)
EndIf
Until Event = #PB_Event_CloseWindow
EndIf