Re: Active Table??
- To: mathgroup at smc.vnet.net
- Subject: [mg17398] Re: Active Table??
- From: "P.J. Hinton" <paulh>
- Date: Thu, 6 May 1999 02:44:14 -0400
- Organization: "Wolfram Research, Inc."
- Sender: owner-wri-mathgroup at wolfram.com
On Mon, 3 May 1999 in article <7gfr8q$6dd at smc.vnet.net>, Jason Gill
<jgill at vbimail.champlain.edu> writes:
> Does anyone have any ideas on how to make an "Active Table?" What I
> mean is, suppose I have a nice table of variables variable[[i,j]],
> displayed in say a Grid Box. Is it possible to make this table active
> in the sense that the values may be edited in place and doing so changes
> the actual definition of variable? It seems as though palettes might be
> headed in the right direction, but I don't quite see how. Any
> suggestions would be appreciated.
There is no way to get the table to update variable assignments
automatically, but you might be able to set up a grid box that looks like
this
label assignment button to perform assignment
Paste this expression into a notebook and evaluate it to see an example.
DisplayForm[GridBox[{{"a = ",
TagBox["\[Placeholder]", "assignment for a"],
ButtonBox["do assignment", Rule[ButtonSource, Cell],
RuleDelayed[ButtonFunction,
Function[Set[a, ReplaceAll[Cases[Slot[1],
TagBox[Blank[String], "assignment for a"], -1],
Rule[List[TagBox[Pattern[inp, Blank[]],
Blank[]]], inp]]]]], Rule[Active, True],
Rule[ButtonEvaluator, Automatic]]}}]]
entering a value into the place holder in the second column and then
clicking on the button in the third column will assign whatever you put in
the placeholder to the value of the symbol "a".
The trick here is to use a TagBox[] construct for letting the kernel pick
out the user's data input into the grid.
--
P.J. Hinton
Mathematica Programming Group paulh at wolfram.com
Wolfram Research, Inc. http://www.wolfram.com/~paulh/