[SOLVED] EventType() not working for me

Just starting out? Need help? Post your questions and find answers here.
Randy Walker
Addict
Addict
Posts: 1059
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

[SOLVED] EventType() not working for me

Post 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
Last edited by Randy Walker on Tue Aug 05, 2025 12:43 am, edited 1 time in total.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
User avatar
minimy
Enthusiast
Enthusiast
Posts: 613
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: EventType() not working for me

Post 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.
If translation=Error: reply="Sorry, Im Spanish": Endif
Randy Walker
Addict
Addict
Posts: 1059
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

Re: EventType() not working for me

Post 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.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
BarryG
Addict
Addict
Posts: 4168
Joined: Thu Apr 18, 2019 8:17 am

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

Post 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. :(
User avatar
Piero
Addict
Addict
Posts: 914
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

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

Post 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:
User avatar
mk-soft
Always Here
Always Here
Posts: 6242
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post 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
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Quin
Addict
Addict
Posts: 1132
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

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

Post 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:
Randy Walker
Addict
Addict
Posts: 1059
Joined: Sun Jul 25, 2004 4:21 pm
Location: USoA

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

Post 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.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Post Reply