Page 1 of 1

ImageGadget Events Confusion

Posted: Fri Feb 18, 2005 8:00 pm
by ebs
ImageGadgets now have events, but it seems they aren't exactly what you might expect.
Specifically, a left click produces a #PB_EventType_LeftClick as expected, but a
left double-click produces a #PB_EventType_RightClick event, which doesn't make sense.
A right click doesn't produce a "Click" event at all.

Try this simple code to see what happens:

Code: Select all

OpenWindow(0, 0, 0, 200, 200, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, "ImageGadget Event Test")
CreateGadgetList(WindowID())
ImageGadget(0, 10, 10, 100, 100, 0, #PB_Image_Border)

Repeat
  Event.l = WaitWindowEvent()
  If Event = #PB_Event_Gadget
    If EventGadgetID() = 0
      Select EventType()
        Case #PB_EventType_LeftClick
          Debug "Left Click"
        Case #PB_EventType_RightClick
          Debug "Right Click"
        Case #PB_EventType_LeftDoubleClick
          Debug "Left Double Click"
      EndSelect
    EndIf
  EndIf
Until Event = #PB_Event_CloseWindow
Can anyone explain which events the ImageGadget is supposed to support?

Thanks,
Eric

Posted: Fri Feb 18, 2005 9:16 pm
by Fred
You're right, there was an inconsistency somewhere. So I've updated the ImageGadget() event handler to support the 4 regulars click events. You can get the new lib here: www.purebasic.com/beta/GadgetExtension

Posted: Fri Feb 18, 2005 9:41 pm
by ebs
Fred,

It works fine now. Thanks for your usual fast service!

Regards,
Eric

Posted: Sat Feb 19, 2005 2:13 am
by DoubleDutch
Great, this makes images gadgets much better - much needed right click. :)