Subject | : Bind Text Variable with an element in a list |
Date | : 2007/05/11(Fri) 14:54:35 |
Contributor | : WangWeizhen < > |
Hi, All. There's a problem while I bind TextVaiable with an element in a list. Look at the script below:
At Last section, I would like to bind the Variable in KBFText to strlist[1] and strlist[2]. While I click the Button to refresh, the "str" and "strlist" both change. But only the Text which bind to "str" changes, the other two which bind to "strlist" do not change.
Can you give some help?
There is a long list to show at realtime.
FFS;
w=KBMainFrame["Date",f,Title->"SAD"];
b=Button[f,Text->"Refresh",Command:>refresh];
strlist={"000","000"};
str = "000";
refresh:=(
str = DateString[];
strlist={DateString[],"It's "//DateString[]};
Print[str];
Print[strlist[1]];
Print[strlist[2]];
);
cf=KBFComponentFrame[f,
Add->{
KBFGroup[Text->"Group1"],
KBFText[Text->"Time";],
KBFText[Variable:>str],
KBFText[Variable:>strlist[1]],
KBFText[Variable:>strlist[2]]
}
];
TkWait[];
Further more, can "For" loop be used while bind Variables to KBFText?
like:
For[i=1,i<=10,i++,
KBFText[Variable:>strlist[i]]];