Re: Timer event
- To: mathgroup at smc.vnet.net
- Subject: [mg104224] Re: [mg104205] Timer event
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Sat, 24 Oct 2009 02:39:47 -0400 (EDT)
Some time ago we discussed here a kind of alike situation. The code below is used to dynamically accentuate a displayed expression. Namely, a part of an expression is made blinking few times upon the mouse click. It utilizes the Clock function for showing the dynamic accentuation only for a certain time, that looks to be what you are looking for. Have a look: Ac[expr_] := DynamicModule[{c1 = 0}, EventHandler[ Dynamic[ If[c1 == 0, Style[expr, Black, Plain, 22, Italic] // ExpressionCell, Dynamic@If[Clock[1, 0.7, 2] < .5, Style[expr, Gray, Plain, 22, Italic] // ExpressionCell, Style[expr, RGBColor[0.8, 0, 0], Bold, 23, Italic]] // ExpressionCell ] ], {"MouseDown" :> (c1 = c1 /. {0 -> 1, 1 -> 0})} ] ]; (* The following is only to show an example of its use *) Row[{"F=\[Integral]{" , " \!\(\*FractionBox[\"1\", \ \"2\"]\)\!\(\*SuperscriptBox[\"\[Alpha]\ \[Eta]\", \"2\"]\)+\!\(\*FractionBox[\"1\", \ \"4\"]\)\!\(\*SuperscriptBox[\"\[Beta]\[Eta]\", \ \"4\"]\)+\!\(\*FractionBox[\"1\", \"6\"]\)\!\(\*SuperscriptBox[\"\ \[Gamma]\[Eta]\", \"6\"]\)" // Ac, " + \!\(\*FractionBox[\"1\", \ \"2\"]\)(\[Del]\[Eta]\!\(\*SuperscriptBox[\")\", \"2\"]\)" // Ac, " +\!\(\*FractionBox[\"1\", RowBox[{\" \", \"2\"}]]\)\!\(\*SubscriptBox[\"C\", \ \"ijkl\"]\)\!\(\*SubscriptBox[\"\[Epsilon]\", \ \"ij\"]\)\!\(\*SubscriptBox[\"\[Epsilon]\", \"kl\"]\)" // Ac, " + \!\(\*SubscriptBox[\"A\[Epsilon]\", \ \"ii\"]\)\!\(\*SuperscriptBox[\"\[Eta]\", \"2\"]\)" // Ac, "}\!\(\*SuperscriptBox[\"d\", \"3\"]\)R" }] Hope it helps, Alexei An post in 2005/2006 asked about creating a timer or perhaps more accurately a timer event in Mathematica. The responses recommend using JLink and an AddPerioical routine described in the JLink documentation in version 5.2. I'd like to create a timer event or perhaps a number of such timer events such that Mathematica would run some function or take some action at a specified time. Can one do this any more directly in Mathematca, without using JLink? Thanks -- Alexei Boulbitch, Dr., habil. Senior Scientist IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 Contern Luxembourg Phone: +352 2454 2566 Fax: +352 2454 3566 Website: www.iee.lu This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.