ImageGadget Events Confusion

Everything else that doesn't fall into one of the other PB categories.
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

ImageGadget Events Confusion

Post 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
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post 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
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

Fred,

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

Regards,
Eric
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Great, this makes images gadgets much better - much needed right click. :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Post Reply