If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
I'm looking for a solution to navigate/control in a window which has radiobuttons and buttons by using simulated "tab", "shift+tab" and "return" keyboard events.
From "somewhere outside" the user sends some commands (for example via network) and these commands should handled like "tab", "shift+tab" and "return". Therefore I need a function which can generate and send keyboard events to the main frame or actual notebook page.
Thank you for this hint!
However is there no wxWidgets functionality which can do the same? The program is actual for windows, but I would like to make it as portable as possible...
Normally I can move the focus from button to button with the Tab key from my keyboard. De-/Activating radiobuttons and buttons can be made with the Return key from my keyboard.
When I try to generate these keyboard events (see my code snipplet) nothing happens. Absolutely nothing...
Do you mean, I should use a panel for each button/radiobutton in my GridBag Sizer?
Normally I can move the focus from button to button with the Tab key from my keyboard. De-/Activating radiobuttons and buttons can be made with the Return key from my keyboard.
First of all what do you mean by (de)activating (radio)buttons? Enabling/Disabling them? Showing/Hiding? (De)Selecting?
Second, you should have a keyboard event handler. Try to step into this function, if it is called, and see what is going on.
Third, where did you put the code you show in the first post? main panel, notebook or book panel?
then the corresponding function will be called - it means that the event has been triggered. For all other (panel, notebook_panel and so on) no function call appears. I have no idea, which event handler must be used - it seems, that "this" might be an good option...
However - the event was triggered - but it has absolutely no effect for the GUI controls. With my keyboard Tab I can move the focus from button to button - with Return from my keyboard I can select or deselect radiobuttons.
The same events simulated with
then the corresponding function will be called - it means that the event has been triggered. For all other (panel, notebook_panel and so on) no function call appears. I have no idea, which event handler must be used - it seems, that "this" might be an good option...
However - the event was triggered - but it has absolutely no effect for the GUI controls. With my keyboard Tab I can move the focus from button to button - with Return from my keyboard I can select or deselect radiobuttons.
The same events simulated with
Connect()? It connects a function with an event handler (and type), but I have no function to connect. The function which has to be triggered by this event is implemented somewhere in a library. It's the function which gives users the possibility to control applications with their keyboard...
grf wrote:
Connect()? It connects a function with an event handler (and type), but I have no function to connect. The function which has to be triggered by this event is implemented somewhere in a library. It's the function which gives users the possibility to control applications with their keyboard...
Regards
Michael
grf,
Just for testing purposes, can you create such handler locally and connect to it.
Just a wild guess, but maybe there is something wrong with the libary passing arguments correctly.....
I just wrote such a simple handler (member function, static event table) and it was called. It means that the event was passed to it. Ok so far...
However, when I try to send the event without my own handler ProcessEvent() returns "false". That means, it couldn't find a suitable event handler. Somewhere in the whole program (in the wx library) must be such a handler, because events from the real keyboard are handled correctly.
That confuses me, but it seems to be my problem: The event seems to be not propagated to the suitable handler which handles keyboard events for navigating the GUI via keyboard.
Therefore I tried to set the propagation level to "1" via