Action when hovering over a ButtonGadget.

Just starting out? Need help? Post your questions and find answers here.
User avatar
matalog
Enthusiast
Enthusiast
Posts: 305
Joined: Tue Sep 05, 2017 10:07 am

Action when hovering over a ButtonGadget.

Post by matalog »

Is there a way to know when the mouse is over a button gadget in Windows, so that I can perform another piece of code.

Gadgettooltip is similar to what I want, but I would like to use my own code, instead of just the standard tooltip.
User avatar
mk-soft
Always Here
Always Here
Posts: 6315
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Action when hovering over a ButtonGadget.

Post by mk-soft »

My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: Action when hovering over a ButtonGadget.

Post by RASHAD »

Hi

Code: Select all


OpenWindow(0, 0, 0, 400, 300, "Mouse Hover", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

TextGadget    (0,  10,  10, 100, 24, "ListIcon Standard", #PB_Text_Center)
ListIconGadget(1,  10,  40, 380, 200, "Column 1", 100) 
ButtonGadget  (2, 10, 250, 140, 24, "Add Gadget")

Repeat
  Select WaitWindowEvent(1)
      
    Case #PB_Event_CloseWindow 
      Quit = 1
      
    Case #WM_MOUSEMOVE         
      GetCursorPos_ (@p.POINT) 
      ScreenToClient_ (WindowID(0), @p)
      Select ChildWindowFromPoint_ (WindowID(0), p\y<< 32+p\x)
        Case WindowID(0)
          Debug "Window 0"
        Case GadgetID(0) 
          Debug "TextGadget 0"  
        Case GadgetID(1)
          Debug "ListIcon 1" 
        Case GadgetID(2)
          Debug "ButtonGadget 2"
          
      EndSelect      
  EndSelect
  
Until Quit = 1

Egypt my love
User avatar
matalog
Enthusiast
Enthusiast
Posts: 305
Joined: Tue Sep 05, 2017 10:07 am

Re: Action when hovering over a ButtonGadget.

Post by matalog »

2 good options, thanks guys.
Post Reply