[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] "Ctrl-+" keyboard accelerator
From: |
Greg Chicares |
Subject: |
Re: [lmi] "Ctrl-+" keyboard accelerator |
Date: |
Wed, 27 Jan 2021 17:21:48 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
On 1/27/21 4:52 PM, Vadim Zeitlin wrote:
> On Wed, 27 Jan 2021 14:49:09 +0000 Greg Chicares <gchicares@sbcglobal.net>
> wrote:
>
> GC> On lmi's "Census" menu:
> GC> Add cell Ctrl-+
> GC> ...exactly what does "Ctrl-+" mean? There are three reasonable
> interpretations:
> GC> (1) holding down Ctrl, press the key labelled "+" over "="
> GC> (2) holding down Ctrl and Shift, press the key labelled "+" over "="
> GC> because Shift normally chooses between "=" and "+"
> GC> (3) holding down Ctr, press the "gray" numeric-keypad "+" key
> GC> Today's actual lmi behavior:
> GC> (1) performs "Add cell", but (2) and (3) don't
> GC> Desired behavior:
> GC> (1), (2), and (3) all perform "Add cell"
> GC> [Cf. firefox, where all three do the same thing.]
> GC>
> GC> Vadim--how can this be accomplished in lmi?
>
> In wx the 3 scenarios correspond to 3 different accelerators:
>
> (1) Ctrl-+
> (2) Shift-Ctrl-+
> (3) Ctrl-Num +
>
> but only a single accelerator can be encoded in the menu label.
Oh.
> So without changing this in wx the only way to achieve what you want is by
> using wxAcceleratorTable with accelerators corresponding to (2) and (3) and
> using the same ID as the menu item, i.e. XRCID("add_cell"). Unfortunately
> this would need to be done in the code, i.e. it can't be done in XRC
> itself.
I wouldn't mind changing something already present in lmi's code,
such as a hypothetical
- set_accelerator(menuitem, wxCtrl + wxKeyPlus);
+ set_accelerators(menuitem, wxCtrl + wxKeyPlus, wxCtrl + wxShift + ...);
and I had a false hope that you'd tell me where to do that. But as
you say it's not C++, it's XRC; and we very much want it to be XRC.
> It shouldn't be very difficult (but not completely trivial neither, I'm
> afraid) to add support for some <extra-accels> child of <menuitem> element
> in XRC allowing to use something like
>
> <object class="wxMenuItem" name="add_cell">
> <label>_Add cell\tCtrl-+</label>
> <extra-accels>
> <accel>Shift-Ctrl-+</accel>
> <accel>Ctrl-Num +</accel>
> </extra-accels>
> ...
> </object>
>
> but this would require modifying wx, of course, and I'm not sure if you
> want to do this.
Yes please.
We have to update wx anyway at least once or twice a year,
though we probably wouldn't do that immediately just for
this.
> Please let me know if you do
Yes please.
> or if you'd like me to make a patch using
> wxAcceleratorTable to lmi (which I rather dislike because it seems ugly to
> define a menu item half in XRC and half in the code, but it's still the
> simplest way to actually make this work).
No, I agree that that's just too ugly.