Code: Select all
While GetMessage_(msg.MSG, #Null, #Null, #Null )
TranslateMessage_(msg)
DispatchMessage_(msg)
Wend
And then considering this:If applications process virtual-key messages for some other purpose, they should not call TranslateMessage. For instance, an application should not call TranslateMessage if the TranslateAccelerator function returns a nonzero value. Note that the application is responsible for retrieving and dispatching input messages to the dialog box. Most applications use the main message loop for this.
we see that keyboard presses and menu commands are closely linked in many cases and that the commonly-seen message pump I quoted is actually inadequate.MSDN wrote:The TranslateAccelerator function processes accelerator keys for menu commands.
The Purebasic message loop cuts through most of the detailed OS-specific message handling and provides the PB coder with event types for each native control. What would make you happy here? What would make you stop using the term "workaround"? I'm going to guess that in this case, you would like to see something checkable in the PB event loop such as #PB_EventType_StringGadget_Return. The PB team could easily add this, it isn't beyond their reach. So let's say they do it, and you're ecstatic. But wait; what happens when the next guy says, "Hey, why doesn't the string gadget recognize the ESC key? Why do we have to use a workaround? All good languages give us this!" Then we're back to square one. By providing keyboard shortcuts (accelerators) together with stringgadget focus events, the Purebasic team has provided us with the fully cross-platform ability to respond to any key or combination in the string gadget with a very simple logic construct. Trust me, this is a good thing.
Here's what I recommend you do: Install gcc and code::blocks and write some Windows GUI's in plain C. Start very small with Static controls, buttons and work your way up to ListViews, Panels, and the like. After a month or two of seeing what it really takes to build a "beginner-level" GUI in just one operating system, you will get a sense of just how powerful and user-friendly the AddKeyboardShortcut-RemoveKeyboardShortcut pair coupled with focus events really is.
Please believe me, this is already native and you already have it.