Mouse over panel tabs?

Just starting out? Need help? Post your questions and find answers here.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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 
I may look like a mule, but I'm not a complete ass.
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Post by kenmo »

:shock: That was fast and works great! Thank you!

But now... :lol: 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.
Post Reply