|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
How to handle standard keyboard shortcuts?Hi, We are having standard keyboard shortcuts like Ctrl+A, Ctrl+C, Ctrl+V, Ctrl+Z and DEL in main menu. Now since these are being used in main menu, they no longer work on any other window. So we endup sending commandevent to the focussed window and writing code to handle them at that window level. I know this is not the right way of doing this. But I dont know how to handle this situation. I had searched the group, but couldn't find any solution to handle this situation. There has to be a proper way to handling this situation. Please help. Thanks in advance. _______________________________________________ wx-users mailing list wx-users@... http://lists.wxwidgets.org/mailman/listinfo/wx-users |
|
|
Re: How to handle standard keyboard shortcuts?On Fri, 5 Sep 2008 06:24:14 -0700 (PDT) wxWidget <soni.sanjjay@...> wrote:
w> We are having standard keyboard shortcuts like Ctrl+A, Ctrl+C, Ctrl+V, w> Ctrl+Z and DEL in main menu. w> Now since these are being used in main menu, they no longer work on w> any other window. They should work for wxTextCtrls, at least in wx2.8 under MSW (what do you use?). w> So we endup sending commandevent to the focussed w> window and writing code to handle them at that window level. w> w> I know this is not the right way of doing this. I agree. w> There has to be a proper way to handling this situation. There should be one but for now we only have a hack in wxMSW which makes sure that the keys used as standard accelerators by the text controls (this includes Ctrl-C/V/Z but not Ctrl-A, probably by mistake) are not stolen by the accelerators. We should generalize it and make it public but this just wasn't done yet. So right now you have to override the MSW-specific MSWShouldPreProcessMessage() method and check for your keys in it (see wxTextCtrl version for inspiration). I think the problem only exists under wxMSW though (due to the fact that accelerators need to be processed before the char event is generated, so we can't wait until the key event is processed and only check for accelerators if it wasn't handled) so the above should work in practice but it's still horribly ugly, of course. Unfortunately I simply don't have any better ideas right now -- any proposals would be welcome. Regards, VZ -- TT-Solutions: wxWidgets consultancy and technical support http://www.tt-solutions.com/ _______________________________________________ wx-users mailing list wx-users@... http://lists.wxwidgets.org/mailman/listinfo/wx-users |
|
|
|
|
|
Re[2]: How to handle standard keyboard shortcuts?On Mon, 8 Sep 2008 02:29:01 -0700 (PDT) wxWidget <soni.sanjjay@...> wrote:
w> I tried to look into src\msw\textCtrl.cpp of both wxWidget 2.6.2 and w> 2.8 and they are same for MSWShouldPreProcessMessage function. w> So something is still missing for Ctrl+A in the case of simple w> textctrl. Yes, Ctrl+A is still not handled by it but it should be trivial to change it. Have you tried modifying MSWShouldPreProcessMessage() to return false for Ctrl+A in 2.8? w> And obviously all these standard keyboard shortcuts don't work any w> other controls like spinctrl etc. Yes. As I said, it is a problem but I don't have any smart solution for it (a dumb one would be to use the same MSWShouldPreProcessMessage() implementation for wxSpinCtrl as well). Regards, VZ -- TT-Solutions: wxWidgets consultancy and technical support http://www.tt-solutions.com/ _______________________________________________ wx-users mailing list wx-users@... http://lists.wxwidgets.org/mailman/listinfo/wx-users |
|
|
|
|
|
Re[2]: How to handle standard keyboard shortcuts?On Mon, 8 Sep 2008 23:36:10 -0700 (PDT) wxWidget <soni.sanjjay@...> wrote:
w> Hmm, yes I did modified MSWShouldPreProcessMessage() function of w> wxTextCtrl class and return false for Ctrl+A. w> But it is not working in all the cases. w> w> It works only when it is put in a panel, which is the child of w> mainframe. Here too, it works only for MULTILINE text ctrl and not for w> single line text ctrl. w> w> But if I put it in a modal dialog box, it doesn't work at all (for w> both the mulitline and single line text ctrl). Could you please make a minimal patch to the minimal or dialogs sample showing this? I'm afraid I need to see it to understand what's going on here. Thanks, VZ -- TT-Solutions: wxWidgets consultancy and technical support http://www.tt-solutions.com/ _______________________________________________ wx-users mailing list wx-users@... http://lists.wxwidgets.org/mailman/listinfo/wx-users |
|
|
|
|
|
Re[2]: How to handle standard keyboard shortcuts?On Tue, 16 Sep 2008 03:08:42 -0700 (PDT) wxWidget <soni.sanjjay@...> wrote:
w> > w> Hmm, yes I did modified MSWShouldPreProcessMessage() function of w> > w> wxTextCtrl class and return false for Ctrl+A. w> > w> But it is not working in all the cases. ... w> How should I send you the patch? On your mail or upload somewhere? w> Should I just send you the source files or working executable? For the future reference, please see http://trac.wxwidgets.org/wiki/HowToSubmitPatches It is for submitting the patches fixing a problem but most of the instructions apply to patches reproducing the problem too. However in this particular case it's actually not necessary as I realized that it's not really surprising that Ctrl-A doesn't work in when it doesn't work in plain Windows neither -- the edit controls do *not* select their text on Ctrl-A. It's a common shortcut, true, but, unlike Ctrl-{C,X,V}, not a built-in one. So this has nothing to do with MSWShouldPreProcessMessage(), you simply have to implement Ctrl-A handling yourself. Regards, VZ -- TT-Solutions: wxWidgets consultancy and technical support http://www.tt-solutions.com/ _______________________________________________ wx-users mailing list wx-users@... http://lists.wxwidgets.org/mailman/listinfo/wx-users |
|
|
Re: Re[2]: How to handle standard keyboard shortcuts?On Tue, 2008-09-16 at 12:29 +0200, Vadim Zeitlin wrote:
> a built-in one. So this has nothing to do with > MSWShouldPreProcessMessage(), > you simply have to implement Ctrl-A handling yourself. Or use the wxTE_RICH2 style -- richedit controls do implement Ctrl-A. Vaclav _______________________________________________ wx-users mailing list wx-users@... http://lists.wxwidgets.org/mailman/listinfo/wx-users |
| Free Forum Powered by Nabble | Forum Help |