Hello Fred,
to finish an input in StringGadegt by pressing Enter, it would be nice if this would also support #PB_EventType_ReturnKey.
Ciao Dirk
StringGadget () EventTypes
Re: StringGadget () EventTypes
Hello Dirk,
for this one we have the AddKeyboardShortcut()-Command
Greetings ... Peter
Edit:
Alternatively, you can use the GadgetEventEx-Module (https://github.com/spiderbytes/GadgetEventEx)
for this one we have the AddKeyboardShortcut()-Command
Code: Select all
Enumeration
#sg1
#sg2
#sg3
#ShortcutReturnEvent
EndEnumeration
Procedure MenuEvents()
Select EventMenu()
Case #ShortcutReturnEvent
Select GetActiveGadget()
Case #sg1
Debug "ReturnKey on #sg1"
Case #sg2
Debug "ReturnKey on #sg2"
Case #sg3
Debug "ReturnKey on #sg3"
EndSelect
EndSelect
EndProcedure
OpenWindow(0, 0, 0, 322, 105, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(#sg1, 8, 10, 306, 20, "")
StringGadget(#sg2, 8, 35, 306, 20, "")
StringGadget(#sg3, 8, 60, 306, 20, "")
AddKeyboardShortcut(0, #PB_Shortcut_Return, #ShortcutReturnEvent)
BindEvent(#PB_Event_Menu, @MenuEvents())
Edit:
Alternatively, you can use the GadgetEventEx-Module (https://github.com/spiderbytes/GadgetEventEx)
Code: Select all
XIncludeFile "GadgetEventEx.sbi"
Enumeration
#Window
#StringGadget
EndEnumeration
Procedure KeyUpEvent(e)
Protected Which
! v_which = v_e.which;
If Which = #CR
Debug "ReturnKey-Event from #StringGadget: " + EventGadget()
EndIf
EndProcedure
OpenWindow(#Window, 0, 0, 300, 300, "GadgetEventExDemo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(#StringGadget, 10, 10, 100, 20, "StringGadget")
GadgetEventEx::Bind(#StringGadget, @KeyUpEvent(), "keyup")
-
- Posts: 284
- Joined: Fri Sep 22, 2017 7:02 am
Re: StringGadget () EventTypes
Thanks Peter!