Re: no Condition in EventHandler?
- To: mathgroup at smc.vnet.net
- Subject: [mg100206] Re: [mg100064] no Condition in EventHandler?
- From: John Fultz <jfultz at wolfram.com>
- Date: Thu, 28 May 2009 04:27:56 -0400 (EDT)
- Reply-to: jfultz at wolfram.com
You are correct. You should, instead, use CurrentValue[] on the rhs of the "MouseDown" event handler to probe the behavior. The EventHandler will trigger for every "MouseDown" event, of course, but just code the event handler so that it's a no-op when you don't need it, and does the appropriate thing when you do. Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Fri, 22 May 2009 01:51:02 -0400 (EDT), Michael wrote: > EventHandler[ > > "TEST", > ("MouseDown" :> Print[1]) /; CurrentValue["AltKey"], > ("MouseDown" :> Print[2]) /; CurrentValue["ControlKey"], > ("MouseDown" :> Print[3]) /; CurrentValue["ShiftKey"], > ("MouseDown" :> > Print[4, CurrentValue["AltKey"], CurrentValue["ControlKey"], > CurrentValue["ShiftKey"]]) /; True, > "MouseDown" :> > Print[5, CurrentValue["AltKey"], CurrentValue["ControlKey"], > CurrentValue["ShiftKey"]] /; False > ] > > Does not do what I expect. (5 is always printed, and nothing else, no > matter what keys are down). > > I can only speculate that EventHandler doesn't evaluate its actions in > such a way that a Condition has a chance to take effect or not?