PureBasic Forum
http://forums.purebasic.com/english/

Please add EventGadget() support for more gadgets
http://forums.purebasic.com/english/viewtopic.php?f=3&t=73678
Page 1 of 1

Author:  Mistrel [ Fri Sep 27, 2019 5:26 pm ]
Post subject:  Please add EventGadget() support for more gadgets

It didn't occur to me until today when I tried to use #PB_EventType_RightClick with an ImageButtonGadget() that I realized that this isn't supported. While #PB_EventType_LeftClick does seem to work for both ButtonGadget() and ImageButtonGadget(), it's not listed as supported in either the gadget documentation or for EventGadget().

Code:
OpenWindow(#PB_Any,0,0,130,70,"",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)

GadgetButton=ButtonGadget(#PB_Any,38,10,48,48,"")

Repeat
  Event=WaitWindowEvent()
 
  Select Event
  Case #PB_Event_Gadget
    If EventGadget()=GadgetButton
      Select EventType()
      Case #PB_EventType_LeftClick
        Debug "Click with left mouse button"
      Case #PB_EventType_RightClick
        Debug "Click with right mouse button"
      Case #PB_EventType_LeftDoubleClick
        Debug "Double-click with left mouse button"
      Case #PB_EventType_RightDoubleClick
        Debug "Double-click with right mouse button"
      EndSelect
    EndIf
  EndSelect
Until Event=#PB_Event_CloseWindow

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/