Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » GTK+
  • » Problems with accelerators. [RSS Feed]

#1 June 18, 2010 17:12:10

sledge h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problems with accelerators.


I have some problems with accelerators. What do I need to do make an action
fire when I press the * symbol? If I use for accelerator the GDK_asterisk
define then the action is fired only when I press shift+8. I want it to fire
when I press the * symbol in the numpad TOO. The same goes for /,+,- . What do
I need to do to achieve this? Are there special "define"s in gdk/gdkkeysyms.h?

Also what defines should I use for these symbols: ^(shift+6), | (pipe)?

_________________________________________________________________
Το email σας και πολλά ακόμα εν κινήσει. Αποκτήστε δωρεάν το Windows Live
Hotmail.https://signup.live.com/signup.aspx?id=60969_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#2 June 18, 2010 18:14:36

Tadej B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problems with accelerators.


Hi.

> I have some problems with accelerators. What do I need to do make an action
> fire when I press the * symbol? If I use for accelerator the GDK_asterisk
> define then the action is fired only when I press shift+8. I want it to fire
> when I press the * symbol in the numpad TOO. The same goes for /,+,- . What
> do I need to do to achieve this? Are there special "define"s in
> gdk/gdkkeysyms.h?

There are special defines in gdkkeysyms.h file:
* - GDK_KP_Multiply
/ - GDK_KP_Divide
+ - GDK_KP_Add
- - GDK_KP_Substract

> Also what defines should I use for these symbols: ^(shift+6), | (pipe)?

Not sure about these ones, but my advice would be not to use them. ^
might be mapped to shift+6 on your keyboard layout, but usually things
are much more complicated on other international layouts (for example,
on my Slovenian keyboard layout, ^ can only be displayed by pressing
"AltGr+3" and "space" - yes, it takes 2 steps and 3 keys to get this
single character).

Tadej

--
Tadej Borovšak
tadeboro.blogspot.com
tadeb***@*mail.com
tadej.borov***@*mail.com
_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#3 June 19, 2010 11:36:14

sledge h.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problems with accelerators.


> From: tadeb***@*mail.com
> Date: Fri, 18 Jun 2010 19:13:58 +0200
> Subject: Re: Problems with accelerators.
> To: sledgehammer_***@*otmail.com
> CC: gtk-l***@*nome.org
>
> Hi.
>
> > I have some problems with accelerators. What do I need to do make an action
> > fire when I press the * symbol? If I use for accelerator the GDK_asterisk
> > define then the action is fired only when I press shift+8. I want it to fire
> > when I press the * symbol in the numpad TOO. The same goes for /,+,- . What
> > do I need to do to achieve this? Are there special "define"s in
> > gdk/gdkkeysyms.h?
>
> There are special defines in gdkkeysyms.h file:
> * - GDK_KP_Multiply
> / - GDK_KP_Divide
> + - GDK_KP_Add
> - - GDK_KP_Substract
>

I want the action to fire to both key-presses, both with GDK_asterisk(in my
keyboard shift+8) and GDK_KP_Multiply (in numpad).
Is this even possible?



> > Also what defines should I use for these symbols: ^(shift+6), | (pipe)?
>
> Not sure about these ones, but my advice would be not to use them. ^
> might be mapped to shift+6 on your keyboard layout, but usually things
> are much more complicated on other international layouts (for example,
> on my Slovenian keyboard layout, ^ can only be displayed by pressing
> "AltGr+3" and "space" - yes, it takes 2 steps and 3 keys to get this
> single character).
>
> Tadej
>
> --
> Tadej Borovšak
> tadeboro.blogspot.com
> tadeb***@*mail.com
> tadej.borov***@*mail.com

_________________________________________________________________
Hotmail: Ισχυρό, δωρεάν email με ασφάλεια από τη Microsoft.https://signup.live.com/signup.aspx?id=60969_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#4 June 19, 2010 17:58:32

Paul D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problems with accelerators.


On Sat, Jun 19, 2010 at 6:30 AM, sledge hammer
<sledgehammer_***@*otmail.com> wrote:

> I want the action to fire to both key-presses, both with GDK_asterisk(in my
> keyboard shift+8) and GDK_KP_Multiply (in numpad).
> Is this even possible?

basically, no.

bindings are from keycodes to actions, not characters to actions.
KP_Multiply and "*" are entirely different keycodes even if they might
often be associated with the same character when used for text entry
etc.

if you want to do this, you'd have to take over keyboard event
handling yourself and then lookup the actions/closures and activate
them.
_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#5 June 19, 2010 18:08:46

Tristan V.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problems with accelerators.


On Sat, Jun 19, 2010 at 12:58 PM, Paul Davis <p***@*inuxaudiosystems.com> wrote:
> On Sat, Jun 19, 2010 at 6:30 AM, sledge hammer
> <sledgehammer_***@*otmail.com> wrote:
>
>> I want the action to fire to both key-presses, both with GDK_asterisk(in my
>> keyboard shift+8) and GDK_KP_Multiply (in numpad).
>> Is this even possible?
>
> basically, no.
>

I think you could do something roundabout like calling
gtk_widget_add_accelerator()
multiple times on one of your action's visible proxies (and yourself
ensuring that
the accel group <--> widget <--> window relationships are setup correctly).

Curiously, is there a specific reason/policy why GtkActions dont like to have
multiple accel keys defined ?

> bindings are from keycodes to actions, not characters to actions.
> KP_Multiply and "*" are entirely different keycodes even if they might
> often be associated with the same character when used for text entry
> etc.
>
> if you want to do this, you'd have to take over keyboard event
> handling yourself and then lookup the actions/closures and activate
> them.
> _______________________________________________
> gtk-list mailing list
> gtk-l***@*nome.org
>http://mail.gnome.org/mailman/listinfo/gtk-list>
_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#6 June 19, 2010 18:16:05

Paul D.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Problems with accelerators.


On Sat, Jun 19, 2010 at 1:08 PM, Tristan Van Berkom <t***@*nome.org> wrote:
> I think you could do something roundabout like calling
> gtk_widget_add_accelerator()
> multiple times on one of your action's visible proxies (and yourself
> ensuring that
> the accel group <--> widget <--> window relationships are setup correctly).

this depends a lot on how the bindings are set up. unfortunately there
are at least 2 pathways (possibly 3 and maybe even 4) ways to do so,
and they have different semantics and implications. For example, using
dynamically loaded accel maps will overwrite any existing accelerator.
Or did a while ago.

--p
_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

Board footer

Moderator control

Enjoy the 19th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support