Page 1 of 1

[SOLVED] EventType() not working for me

Posted: Mon Aug 04, 2025 11:31 pm
by Randy Walker
I basically took this code snippet from the help doc but replaced the ListIconGadget with an EditorGadget and get nothing out of that EventType().

Code: Select all

  If OpenWindow(0, 0, 0, 230, 120, "Eventtypes example...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    EditorGadget(0, 8, 8, 306, 133)
    For a = 0 To 5
      AddGadgetItem(0, a, "Line "+Str(a))
    Next
  
     Repeat
       Event = WaitWindowEvent()
       
       Select Event
       
         Case #PB_Event_Gadget
           Select EventGadget()
             Case 0 
               Select EventType()
                 Case #PB_EventType_Change           : Debug "have change"
                 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
           EndSelect
       
       EndSelect
     Until Event = #PB_Event_CloseWindow
  EndIf
The help doc says:
The following gadgets support EventType():
- CanvasGadget() - The CanvasGadget has a special set of event types.
- ComboBoxGadget()
- DateGadget()
- EditorGadget()
- ExplorerListGadget()
- ExplorerTreeGadget()
- ImageGadget()
- ListViewGadget()
- ListIconGadget()
- MDIGadget()
- OpenGLGadget()
- SpinGadget()
- StringGadget()
- TreeGadget()
- WebGadget() - The WebGadget has a special set of event types.
EditorGadget() is listed but I get nothing out of EventType()
Anyone can explain?
Thanks!

Forgot to mention... PB ver 5.40 and 6.20 on Win 11

Re: EventType() not working for me

Posted: Mon Aug 04, 2025 11:46 pm
by minimy
Hello Randy i think only work this:

In EditorGadget say this:
The following events are supported through EventType():
#PB_EventType_Change : the text has been modified by the user.
#PB_EventType_Focus : the editor has got the focus.
#PB_EventType_LostFocus: the editor has lost the focus.

Re: EventType() not working for me

Posted: Tue Aug 05, 2025 12:42 am
by Randy Walker
minimy wrote: Mon Aug 04, 2025 11:46 pm Hello Randy i think only work this:

In EditorGadget say this:
The following events are supported through EventType():
#PB_EventType_Change : the text has been modified by the user.
#PB_EventType_Focus : the editor has got the focus.
#PB_EventType_LostFocus: the editor has lost the focus.
That explains it. Stupid me.

Re: [SOLVED] EventType() not working for me

Posted: Tue Aug 05, 2025 4:15 am
by BarryG
All gadgets should return all event types, IMO. It's silly how we have to code workarounds for detecting keystrokes or right-clicks for some of them. :(

Re: [SOLVED] EventType() not working for me

Posted: Tue Aug 05, 2025 8:13 am
by Piero
BarryG wrote: Tue Aug 05, 2025 4:15 am All gadgets should return all event types, IMO. It's silly how we have to code workarounds for detecting keystrokes or right-clicks for some of them. :(
Example: https://openxtalk.org/OXTDownloads.html :mrgreen:

Re: [SOLVED] EventType() not working for me

Posted: Tue Aug 05, 2025 9:22 pm
by mk-soft
BarryG wrote: Tue Aug 05, 2025 4:15 am All gadgets should return all event types, IMO. It's silly how we have to code workarounds for detecting keystrokes or right-clicks for some of them. :(
Some events are not supported by the respective OS for some controls

Re: [SOLVED] EventType() not working for me

Posted: Wed Aug 06, 2025 5:57 pm
by Quin
BarryG wrote: Tue Aug 05, 2025 4:15 am All gadgets should return all event types, IMO. It's silly how we have to code workarounds for detecting keystrokes or right-clicks for some of them. :(
I agree, at least where possible. Like mk-soft said, not all gadgets support all events cross-platform, but every gadget should at the very least have a focus event.
Sadly, the core of PB development is in the hands of one guy, granted one very awesome guy, so we can't add this even if we want to, I need ugly hacks for something as simple as telling if a combo box got/lost focus :twisted:

Re: [SOLVED] EventType() not working for me

Posted: Fri Aug 08, 2025 2:59 am
by Randy Walker
Quin wrote: Wed Aug 06, 2025 5:57 pm Sadly, the core of PB development is in the hands of one guy, granted one very awesome guy...
Ditto that, so I'm not going to complain.