Thread: New key shortcuts for query window

New key shortcuts for query window

From
Thom Brown
Date:
Hi all,

I think the SQL query window should have a File > Close menu item,
which maps to Ctrl+W (or Apple+W in the case of a Mac).  This is easy
to add.  But something else I want to change isn't so easy.  I'd like
Execute to be mapped to Ctrl+R (as it's much easier to use in OSX
since F keys are far less used since they need to be used in
combination with the fn key).  This is already mapped to F5, and it's
easy to make it work with both, but I can't get the menu item to
display both mappings because of how wxMenuItem::Append works.  It
appears you can only specify one accelerator per menu item.  You can
add another menu item for the additional key binding, but that looks
rubbish.

Any idea if it's possible to show both key bindings on the same item?

e.g. Execute   F5/Ctrl+R

Thanks

Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: New key shortcuts for query window

From
Dave Page
Date:
On Sun, Jul 10, 2011 at 1:45 PM, Thom Brown <thom@linux.com> wrote:
> Hi all,
>
> I think the SQL query window should have a File > Close menu item,
> which maps to Ctrl+W (or Apple+W in the case of a Mac).  This is easy
> to add.

We already have File -> Exit, which uses Ctrl+W. On the Mac, that
currently gets mapped to pgAdmin3 -> Quit pgAdmin3, which is Cmd+Q.

That could certainly be cleaned up on frmQuery, but should also be
done on other forms at the same time.

> But something else I want to change isn't so easy.  I'd like
> Execute to be mapped to Ctrl+R (as it's much easier to use in OSX
> since F keys are far less used since they need to be used in
> combination with the fn key).  This is already mapped to F5, and it's
> easy to make it work with both, but I can't get the menu item to
> display both mappings because of how wxMenuItem::Append works.  It
> appears you can only specify one accelerator per menu item.  You can
> add another menu item for the additional key binding, but that looks
> rubbish.
>
> Any idea if it's possible to show both key bindings on the same item?
>
> e.g. Execute   F5/Ctrl+R

No, I don't believe you can, because wxWidgets menus try to interpret
the string after \t in the text to auto-create the accelerator keys.


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: New key shortcuts for query window

From
Thom Brown
Date:
On 12 July 2011 10:59, Dave Page <dpage@pgadmin.org> wrote:
> On Sun, Jul 10, 2011 at 1:45 PM, Thom Brown <thom@linux.com> wrote:
>> Hi all,
>>
>> I think the SQL query window should have a File > Close menu item,
>> which maps to Ctrl+W (or Apple+W in the case of a Mac).  This is easy
>> to add.
>
> We already have File -> Exit, which uses Ctrl+W. On the Mac, that
> currently gets mapped to pgAdmin3 -> Quit pgAdmin3, which is Cmd+Q.

But Cmd+Q tends to mean quit application rather than exit window, at
least it does in all the other apps I use.  And I don't have a
File>Exit on my Query window in PgAdmin on the Mac.

> That could certainly be cleaned up on frmQuery, but should also be
> done on other forms at the same time.

Yes, not sure how many other forms need updating.

>> But something else I want to change isn't so easy.  I'd like
>> Execute to be mapped to Ctrl+R (as it's much easier to use in OSX
>> since F keys are far less used since they need to be used in
>> combination with the fn key).  This is already mapped to F5, and it's
>> easy to make it work with both, but I can't get the menu item to
>> display both mappings because of how wxMenuItem::Append works.  It
>> appears you can only specify one accelerator per menu item.  You can
>> add another menu item for the additional key binding, but that looks
>> rubbish.
>>
>> Any idea if it's possible to show both key bindings on the same item?
>>
>> e.g. Execute   F5/Ctrl+R
>
> No, I don't believe you can, because wxWidgets menus try to interpret
> the string after \t in the text to auto-create the accelerator keys.

Darn. :(

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: New key shortcuts for query window

From
Dave Page
Date:
On Tue, Jul 12, 2011 at 11:03 AM, Thom Brown <thom@linux.com> wrote:
> On 12 July 2011 10:59, Dave Page <dpage@pgadmin.org> wrote:
>> On Sun, Jul 10, 2011 at 1:45 PM, Thom Brown <thom@linux.com> wrote:
>>> Hi all,
>>>
>>> I think the SQL query window should have a File > Close menu item,
>>> which maps to Ctrl+W (or Apple+W in the case of a Mac).  This is easy
>>> to add.
>>
>> We already have File -> Exit, which uses Ctrl+W. On the Mac, that
>> currently gets mapped to pgAdmin3 -> Quit pgAdmin3, which is Cmd+Q.
>
> But Cmd+Q tends to mean quit application rather than exit window, at
> least it does in all the other apps I use.  And I don't have a
> File>Exit on my Query window in PgAdmin on the Mac.

That's because wxWidgets maps the Exit option to Quit on the Mac. And
yes, this doesn't need cleanup...

>> That could certainly be cleaned up on frmQuery, but should also be
>> done on other forms at the same time.
>
> Yes, not sure how many other forms need updating.

Probably half a dozen or so.

>>> But something else I want to change isn't so easy.  I'd like
>>> Execute to be mapped to Ctrl+R (as it's much easier to use in OSX
>>> since F keys are far less used since they need to be used in
>>> combination with the fn key).  This is already mapped to F5, and it's
>>> easy to make it work with both, but I can't get the menu item to
>>> display both mappings because of how wxMenuItem::Append works.  It
>>> appears you can only specify one accelerator per menu item.  You can
>>> add another menu item for the additional key binding, but that looks
>>> rubbish.
>>>
>>> Any idea if it's possible to show both key bindings on the same item?
>>>
>>> e.g. Execute   F5/Ctrl+R
>>
>> No, I don't believe you can, because wxWidgets menus try to interpret
>> the string after \t in the text to auto-create the accelerator keys.
>
> Darn. :(
>
> --
> Thom Brown
> Twitter: @darkixion
> IRC (freenode): dark_ixion
> Registered Linux user: #516935
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: New key shortcuts for query window

From
Thom Brown
Date:
On 12 July 2011 11:11, Dave Page <dpage@pgadmin.org> wrote:
> On Tue, Jul 12, 2011 at 11:03 AM, Thom Brown <thom@linux.com> wrote:
>> On 12 July 2011 10:59, Dave Page <dpage@pgadmin.org> wrote:
>>> On Sun, Jul 10, 2011 at 1:45 PM, Thom Brown <thom@linux.com> wrote:
>>>> Hi all,
>>>>
>>>> I think the SQL query window should have a File > Close menu item,
>>>> which maps to Ctrl+W (or Apple+W in the case of a Mac).  This is easy
>>>> to add.
>>>
>>> We already have File -> Exit, which uses Ctrl+W. On the Mac, that
>>> currently gets mapped to pgAdmin3 -> Quit pgAdmin3, which is Cmd+Q.
>>
>> But Cmd+Q tends to mean quit application rather than exit window, at
>> least it does in all the other apps I use.  And I don't have a
>> File>Exit on my Query window in PgAdmin on the Mac.
>
> That's because wxWidgets maps the Exit option to Quit on the Mac. And
> yes, this doesn't need cleanup...

This is still inconsistent with virtually ever other application on
OSX, so I think this is something wrong with wxWidgets then.

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: New key shortcuts for query window

From
Dave Page
Date:
On Tue, Jul 12, 2011 at 11:28 AM, Thom Brown <thom@linux.com> wrote:
> On 12 July 2011 11:11, Dave Page <dpage@pgadmin.org> wrote:
>> On Tue, Jul 12, 2011 at 11:03 AM, Thom Brown <thom@linux.com> wrote:
>>> On 12 July 2011 10:59, Dave Page <dpage@pgadmin.org> wrote:
>>>> On Sun, Jul 10, 2011 at 1:45 PM, Thom Brown <thom@linux.com> wrote:
>>>>> Hi all,
>>>>>
>>>>> I think the SQL query window should have a File > Close menu item,
>>>>> which maps to Ctrl+W (or Apple+W in the case of a Mac).  This is easy
>>>>> to add.
>>>>
>>>> We already have File -> Exit, which uses Ctrl+W. On the Mac, that
>>>> currently gets mapped to pgAdmin3 -> Quit pgAdmin3, which is Cmd+Q.
>>>
>>> But Cmd+Q tends to mean quit application rather than exit window, at
>>> least it does in all the other apps I use.  And I don't have a
>>> File>Exit on my Query window in PgAdmin on the Mac.
>>
>> That's because wxWidgets maps the Exit option to Quit on the Mac. And
>> yes, this doesn't need cleanup...
>
> This is still inconsistent with virtually ever other application on
> OSX, so I think this is something wrong with wxWidgets then.

No, it maps Exit to Quit - that's consistent. It's us that are using
Exit on lower level windows which is not really right (interestingly,
it is on the query tool, *if* it's started standalone).


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company