Page 1 of 1

EventType()

Posted: Sun Nov 25, 2007 6:32 pm
by Little John
Hello,
PureBasic 4.10 Help file wrote:The following gadgets support EventType():

- ExplorerListGadget()
- ExplorerTreeGadget()
- ImageGadget()
- ListViewGadget()
- ListIconGadget()
- MDIGadget()
- SpinGadget()
- StringGadget()
- WebGadget()
IMHO it would be useful if other gadgets, for instance the ComboBoxGadget, would support EventType() as well.

Regards, Little John

Re: EventType()

Posted: Sat Oct 17, 2009 8:33 am
by thyphoon
+1

Re: EventType()

Posted: Sat Oct 31, 2009 7:57 pm
by Jacobus
+1
And specifically the EditorGadget() to display a context menu can be easily used.
Thank you in advance.

Re: EventType()

Posted: Sun Nov 01, 2009 1:27 pm
by Ulix
+1 :!:

Re: EventType()

Posted: Sun Nov 01, 2009 4:57 pm
by Marlin
I basically like the idea of EventType() for [allmost] all gadgets.

There might however be aspects that make that more difficult,
than we might think.

F.e. I found, that the EditorGadget() does automatically get a nice context menu (from Gtk?) in the Linux version.

Re: EventType()

Posted: Mon Nov 02, 2009 4:11 pm
by User_Russian
IMHO it would be useful if other gadgets, for instance the ComboBoxGadget, would support EventType() as well.
There is support In Windows

Code: Select all

If OpenWindow(0, 0, 0, 270, 140, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ComboBoxGadget(1, 10, 40, 250, 21)
    For a = 1 To 5
      AddGadgetItem(1, -1,"ComboBox item " + Str(a))
    Next
   SetGadgetState(1, 2)    ; set (beginning with 0) the third item as active one
   
  Repeat 
   Event=WaitWindowEvent()
   Gadget=EventGadget()
   Type=EventType()
   
    If Event=#PB_Event_Gadget And Gadget=1
      Debug Type
    EndIf
  Until  Event = #PB_Event_CloseWindow
EndIf

Re: EventType()

Posted: Mon Nov 02, 2009 11:01 pm
by Little John
Oh, some "quick responses" after almost 2 years. :lol:
User_Russian wrote:
IMHO it would be useful if other gadgets, for instance the ComboBoxGadget, would support EventType() as well.
There is support In Windows

Code: Select all

If OpenWindow(0, 0, 0, 270, 140, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ComboBoxGadget(1, 10, 40, 250, 21)
    For a = 1 To 5
      AddGadgetItem(1, -1,"ComboBox item " + Str(a))
    Next
   SetGadgetState(1, 2)    ; set (beginning with 0) the third item as active one
   
  Repeat 
   Event=WaitWindowEvent()
   Gadget=EventGadget()
   Type=EventType()
   
    If Event=#PB_Event_Gadget And Gadget=1
      Debug Type
    EndIf
  Until  Event = #PB_Event_CloseWindow
EndIf
a) When you look at the help for EventType(), then you'll see that now (PB 4.40 Beta 5) the list of supported gadgets is exactly the same as the list which I posted 2 years ago. So either additional gadgets are not supported until now, or they are secretely supported and their support is not documented.

b) Well, your above code does do something ...

But when you get the example code from the help for EventType(), and just replace

Code: Select all

ListIconGadget(1, 10, 10, 150, 100, "ListIcon", 140, #PB_ListIcon_GridLines)
with

Code: Select all

ComboBoxGadget(1, 10, 10, 150, 20)
then e.g. clicking at an item with the left mouse button results (with PB 4.40 Beta 5 on Windows XP x86) in the message
Debug wrote:Click with right mouse button
That's not what I meant when I wrote "support EventType()". Of course, all the constants documented in the help should have the same meaning for all supported gadgets.

Regards, Little John

Re: EventType()

Posted: Tue Nov 03, 2009 7:01 am
by ts-soft
ComboBoxGadget does not support eventtype, only some WinAPI event have the same value as #PB_EventType_RightClick