Page 1 of 1
Mouse over panel tabs?
Posted: Mon Jun 05, 2006 10:49 pm
by kenmo
Here's a rather specific (and in my experience, difficult) problem:
I have a window with a statusbar and a panel gadget. Is it possible to detect whether the mouse is over one of the panel's tabs, and which one? I'd like the statusbar to display a message depending on which tab you're pointing at, and I'm assuming that needs some tricky callback?
Posted: Mon Jun 05, 2006 11:21 pm
by srod
Code: Select all
;Mouse over panel tab
;By srod,
;PB 4.
tch.TC_HITTESTINFO
If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
PanelGadget (0, 8, 8, 306, 203)
AddGadgetItem (0, -1, "Panel 1")
AddGadgetItem (0, -1,"Panel 2")
ButtonGadget(2, 10, 15, 80, 24,"Button 1")
ButtonGadget(3, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
Repeat
ev=WaitWindowEvent()
Select ev
Case #WM_MOUSEMOVE
;Determine if the cursor is over a tab.
GetCursorPos_(tch\pt)
MapWindowPoints_(#Null,GadgetID(0),tch\pt,1)
item = SendMessage_(GadgetID(0), #TCM_HITTEST,0, tch)
If item>=0
Debug "Mouse over item " + Str(item)
EndIf
EndSelect
Until ev = #PB_Event_CloseWindow
EndIf
Posted: Tue Jun 06, 2006 12:52 am
by kenmo

That was fast and works great! Thank you!
But now...

I hate to ask more, but what API would I use to check which gadget the mouse is over (and then, if it is the panel, use the code you gave me)?[/i]
ETA - Never mind, I got it.