Re: Initialization problem in a DynamicModule
- To: mathgroup at smc.vnet.net
- Subject: [mg106641] Re: [mg106634] Initialization problem in a DynamicModule
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 20 Jan 2010 06:46:12 -0500 (EST)
- References: <26704795.1263897475726.JavaMail.root@n11>
Does this work for you:
Panel@DynamicModule[
{x = True, y, assign},
Attributes[assign] = HoldAll;
assign[x_, y_] := y = x;
assign[x, y];
Grid[{{"", "A", "B"},
{"w/ assign:",
RadioButton[Dynamic[x, (x = #; assign[x, y]) &], True],
RadioButton[Dynamic[x, (x = #; assign[x, y]) &], False]},
{"w/o assign:",
RadioButton[Dynamic@x, True],
RadioButton[Dynamic@x, False]},
{"value:", Dynamic@x}},
Dividers -> {False, {False, True, True, True, False}},
Alignment -> {Left, {Center}}]]
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: Istv=E1n [mailto:replicatorzed at gmail.com]
Dear Group,
I have some problem with a complex interface inside a DynamicModule.
This is a toy version of the program, which can fully reproduce the
malfunction:
Panel@DynamicModule[
{x, y, assign, initialize},
Grid[{
{"", "A", "B"},
{"w/ assign:", RadioButton[Dynamic[x, (x = #; assign) &], True],
RadioButton[Dynamic[x, (x = #; assign) &], False]},
{"w/o assign:", RadioButton[Dynamic@x, True],
RadioButton[Dynamic@x, False]},
{"value:", Dynamic@x}
}, Dividers -> {False, {False, True, True, True, False}},
Alignment -> {Left, {Center}}],
Initialization :> (
assign := (y = x);(* further variables to update *)
initialize := (x = True; assign); (* initialization function *)
initialize;
)
]
Now for some reason, the radiobuttons do not function as intended (at
least as I want).
The following clicking orders do not work:
[w/ + B] then [w/ + A]
[w/o + B] then [w/ + A]
these work correctly:
[w/ + B] then [w/o + A]
[w/o + B] then [w/o + A]
I guess, that the problem is with the "initialize" (or the "assign")
function. Any idea?
Thanks in advance
Istv=E1n