EventType()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

EventType()

Post 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
User avatar
thyphoon
Enthusiast
Enthusiast
Posts: 345
Joined: Sat Dec 25, 2004 2:37 pm

Re: EventType()

Post by thyphoon »

+1
User avatar
Jacobus
Enthusiast
Enthusiast
Posts: 139
Joined: Wed Nov 16, 2005 7:51 pm
Location: France
Contact:

Re: EventType()

Post by Jacobus »

+1
And specifically the EditorGadget() to display a context menu can be easily used.
Thank you in advance.
PureBasicien tu es, PureBasicien tu resteras.
Ulix
User
User
Posts: 48
Joined: Wed Jan 23, 2008 12:45 pm
Location: France, Montpellier

Re: EventType()

Post by Ulix »

+1 :!:
Marlin
Enthusiast
Enthusiast
Posts: 406
Joined: Sun Sep 17, 2006 1:24 pm
Location: Germany

Re: EventType()

Post 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.
User_Russian
Addict
Addict
Posts: 1519
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: EventType()

Post 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
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: EventType()

Post 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
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: EventType()

Post by ts-soft »

ComboBoxGadget does not support eventtype, only some WinAPI event have the same value as #PB_EventType_RightClick
Post Reply