Is there an easy way to capture the keys as they are entered in the Editorgadget? (When the Return key is pressed I want the contents of the editorgadget to be transferred to a database, and the editorgadget "emptied".)
As far as I understand it "KeyboardPushed" etc don't activate the Waitevent, is that right? (The examples I have found all seem to be using Repeat - Until)
There is no menu-item for the event so I can't use the "AddKeyboardShortcut"
All the best / Björn
Capturing keys in editorgadget
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: Capturing keys in editorgadget
For Windows you can use GetAsyncKeyState_(#VK_RETURN) or subclass the editor gadget.
Why can't you use AddKeyboardShortcut()? It seems to work fine.
Why can't you use AddKeyboardShortcut()? It seems to work fine.
Code: Select all
OpenWindow(0, 100, 100, 300, 300, "")
EditorGadget(0, 5, 5, 290, 290)
AddKeyboardShortcut(0, #PB_Shortcut_Return, 1)
Repeat
Event = WaitWindowEvent()
If EventMenu() = 1 And GetActiveGadget() = 0
Debug GetGadgetText(0)
SetGadgetText(0, "")
EndIf
Until Event = #PB_Event_CloseWindow
End
Re: Capturing keys in editorgadget
I must have misunderstood the help file - I thought that you had to have a Menu item that was to be activated by the AddKeyboardShortcut().
Thank you for the rapid help
Björn
Thank you for the rapid help

Björn