Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6182 > unrolled thread

{Keydown,"c"} event in graphics

Started bynicolas@virtualdynamics.fr
First post2011-11-04 11:10 +0000
Last post2011-11-06 10:59 +0000
Articles 5 — 4 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  {Keydown,"c"} event in graphics nicolas@virtualdynamics.fr - 2011-11-04 11:10 +0000
    Re: {Keydown,"c"} event in graphics Silvia <wyelen@gmail.com> - 2011-11-05 09:49 +0000
    Re: {Keydown,"c"} event in graphics Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-11-05 09:52 +0000
    Re: {Keydown,"c"} event in graphics Chris Degnen <degnen@cwgsy.net> - 2011-11-05 09:56 +0000
      Re: {Keydown,"c"} event in graphics nicolas@virtualdynamics.fr - 2011-11-06 10:59 +0000

#6182 — {Keydown,"c"} event in graphics

Fromnicolas@virtualdynamics.fr
Date2011-11-04 11:10 +0000
Subject{Keydown,"c"} event in graphics
Message-ID<j90h73$sn1$1@smc.vnet.net>
Does any body knows how to set a key down event for "c" for an event
handler wrapped around a graphics object ?

The "c" is associated by the front end to the creation of a circle,
and i need this key and others shortcuts for other tasks.

EventHandler[Graphics[{}], {"KeyDown", "c"} :> ( (* does not work *)
Beep[])]

Thanks  Nicolas

[toc] | [next] | [standalone]


#6194

FromSilvia <wyelen@gmail.com>
Date2011-11-05 09:49 +0000
Message-ID<j930s1$a8l$1@smc.vnet.net>
In reply to#6182
I want to know how to shadow the default shortcut too...

btw. for your case, maybe consider using "C" instead of "c", which is triggered by press Shift + c and won't active the default system action under my windows 7 64bit & Mathematica 8.0.1.

[toc] | [prev] | [next] | [standalone]


#6200

FromArmand Tamzarian <mike.honeychurch@gmail.com>
Date2011-11-05 09:52 +0000
Message-ID<j9311p$abf$1@smc.vnet.net>
In reply to#6182
On Nov 4, 10:10 pm, nico...@virtualdynamics.fr wrote:
> Does any body knows how to set a key down event for "c" for an event
> handler wrapped around a graphics object ?
>
> The "c" is associated by the front end to the creation of a circle,
> and i need this key and others shortcuts for other tasks.
>
> EventHandler[Graphics[{}], {"KeyDown", "c"} :> ( (* does not work *)
> Beep[])]
>
> Thanks  Nicolas

Coincidentally I asked tech support about this recently. Some lower
case keys are committed for other functionality. This seems to be the
case with lower case "c". Use upper case "C" and then use Shift "c" to
"activate" e.g.

EventHandler[Graphics[{}], {"KeyDown", "C"} :> ( (* does not work
*)Beep[])]

then do Shift C and it will work. Or alternatively

EventHandler[Graphics[{}], {"KeyDown", "x"} :> ( (* does not work
*)Beep[])]

works okay for me.

Mike

[toc] | [prev] | [next] | [standalone]


#6206

FromChris Degnen <degnen@cwgsy.net>
Date2011-11-05 09:56 +0000
Message-ID<j9317h$ad4$1@smc.vnet.net>
In reply to#6182
On Nov 4, 11:10 am, nico...@virtualdynamics.fr wrote:
> Does any body knows how to set a key down event for "c" for an event
> handler wrapped around a graphics object ?
>
> The "c" is associated by the front end to the creation of a circle,
> and i need this key and others shortcuts for other tasks.
>
> EventHandler[Graphics[{}], {"KeyDown", "c"} :> ( (* does not work *)
> Beep[])]
>
> Thanks  Nicolas

You could comment-out the drawing tools command section in
SystemFiles\FrontEnd\TextResources\Windows\KeyEventTranslations.tr
if that's not too inconvenient.  Or add modifiers.

The letter "b" is not used in the drawing tools commands, so
it works fine in the demo below.

Note, the graphics has to be selected before the KeyDown can
be received.  (MouseDown works more easily.)


DynamicModule[{counter = 0,
  colour = RGBColor[29/85, 29/85, 29/85],
  cols = ColorData[6, "ColorList"]},
 Dynamic[
  EventHandler[Graphics[{colour, Rectangle[{0, 0}, {7, 8}]},
    PlotRange -> {{0, 7}, {0, 8}}, ImageSize -> 200],
   {"KeyDown", "b"} :> (colour =
      cols[[Mod[counter = ++count, 10] + 1]])],
  Initialization :> (count = counter)]]

[toc] | [prev] | [next] | [standalone]


#6225

Fromnicolas@virtualdynamics.fr
Date2011-11-06 10:59 +0000
Message-ID<j95pb9$m75$1@smc.vnet.net>
In reply to#6206
On 5 nov, 10:56, Chris Degnen <deg...@cwgsy.net> wrote:
> On Nov 4, 11:10 am, nico...@virtualdynamics.fr wrote:
>
> > Does any body knows how to set a key down event for "c" for an event
> > handler wrapped around a graphics object ?
>
> > The "c" is associated by the front end to the creation of a circle,
> > and i need this key and others shortcuts for other tasks.
>
> > EventHandler[Graphics[{}], {"KeyDown", "c"} :> ( (* does not work *)
> > Beep[])]
>
> > Thanks  Nicolas
>
> You could comment-out the drawing tools command section in
> SystemFiles\FrontEnd\TextResources\Windows\KeyEventTranslations.tr
> if that's not too inconvenient.  Or add modifiers.

Hello Chris

It seems to be the only way to do, but it is not appropriated to edit
the KeyEventTranslations.tr file directly.

- Is there a way to temporary edit it at the runtime, I mean by a
frontend command, like it is possible for MenuSetup.tr ?

- In  KeyEventTranslations.tr there are type filters. Is there a way
to change the BoxClass of graphics objects so that the GraphEdit2D
object shortcuts are not associated with the object ?

>
> The letter "b" is not used in the drawing tools commands, so
> it works fine in the demo below.
>
> Note, the graphics has to be selected before the KeyDown can
> be received.  (MouseDown works more easily.)
>
> DynamicModule[{counter = 0,
>   colour = RGBColor[29/85, 29/85, 29/85],
>   cols = ColorData[6, "ColorList"]},
>  Dynamic[
>   EventHandler[Graphics[{colour, Rectangle[{0, 0}, {7, 8}]},
>     PlotRange -> {{0, 7}, {0, 8}}, ImageSize -> 200],
>    {"KeyDown", "b"} :> (colour =
>       cols[[Mod[counter = ++count, 10] + 1]])],
>   Initialization :> (count = counter)]]

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web