Page 1 of 1

Action when hovering over a ButtonGadget.

Posted: Wed Mar 26, 2025 11:34 pm
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.

Re: Action when hovering over a ButtonGadget.

Posted: Wed Mar 26, 2025 11:49 pm
by mk-soft

Re: Action when hovering over a ButtonGadget.

Posted: Thu Mar 27, 2025 12:24 am
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


Re: Action when hovering over a ButtonGadget.

Posted: Thu Mar 27, 2025 12:34 am
by matalog
2 good options, thanks guys.

Re: Action when hovering over a ButtonGadget.

Posted: Thu Mar 27, 2025 12:21 pm
by AZJIO