|
[Date Index]
[Thread Index]
[Author Index]
trying to use InputField as a continually attentive string input
- To: mathgroup at smc.vnet.net
- Subject: [mg108827] trying to use InputField as a continually attentive string input
- From: mkr <mileskrains at gmail.com>
- Date: Fri, 2 Apr 2010 05:20:20 -0500 (EST)
I am trying to set up some interactive code where I issue short
instruction strings to drive some additional dynamic code.
My hope was to use an InputField into which I could continuously type
these short instructions, with a given character sequence ("do" in the
code below) acting as the trigger (I was guessing that using the
[Enter] key might not work).
There are a couple of immediate problem behaviors that I observe:
first, when InputField input contains spaces, the cursor keeps getting
moved to inside of the string, second, after ending a string with
"do", the cursor ends up to the right of the InputField, requiring a
[<-] keypress to get the cursor back into the InputField.
I am using 7.0.1 on XP. Code follows:
msgs={};
procstring[ins_String]:=If[StringLength[ins]>1&&StringTake[ins,
{-2,-1}]=="do",AppendTo[msgs,StringTake[ins,{1,-3}]];"",ins]
FullForm@procstring["process thisdo"];
FullForm@procstring["and thisdo"];
FullForm@procstring["but not this"];
msgs
ins="";
InputField[Dynamic[ins,(ins=procstring[#])&],String,ContinuousAction-
>True]
Dynamic[Column@msgs]
Any help fixing this approach, or with some other technique for
achieving the same general sort of input mechanism by another
approach, would be greatly appreciated.
Thanks,
Miles
Prev by Date:
Re: DensityPlot3D ?
Next by Date:
Re: Contexts and Block
Previous by thread:
Re: DensityPlot3D ?
Next by thread:
Re: trying to use InputField as a continually attentive string input
|