Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Initialization problem in a DynamicModule

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106688] Re: [mg106640] Re: [mg106634] Initialization problem in a DynamicModule
  • From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
  • Date: Thu, 21 Jan 2010 04:52:21 -0500 (EST)
  • References: <201001191014.FAA29115@smc.vnet.net> <201001201146.GAA09007@smc.vnet.net> <op.u6uf4odstgfoz2@bobbys-imac.local>

Hi,

> As far as I can tell, y isn't used or displayed in these solutions 
> and isn't defined outside the panel, so what's all that "assign" 
> gyration about?

yes, but that's not of interest for the problem. Even if you do 
display the stuff it doesn't work and
I assume the example was just an artificial minimal one.

DynamicModule[{x, y, assign},
  assign := (y = x);
  Column[{
    Checkbox[Dynamic[x, (x = #; assign;) &], {True, False}],
    Dynamic[{x, y}]
    }
   ], Initialization :> (x = True; assign)
  ]

DynamicModule[{x, y, assign},
  assign[] := (y = x);
  Column[{
    Checkbox[Dynamic[x, (x = #; assign[];) &], {True, False}],
    Dynamic[{x, y}]
    }
   ], Initialization :> (x = True; assign[])
  ]

Cheers
Patrick


> Bobby
>
> On Wed, 20 Jan 2010 05:46:01 -0600, Patrick Scheibe =
<pscheibe at trm.uni-leipzig.de
> > wrote:
>
>> Hi,
>>
>> it matters that your assign and initialize functions have DownValues.
>>
>> 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[];)]
>>
>> Cheers
>> Patrick
>>
>>
>> On Tue, 2010-01-19 at 05:14 -0500, Istv=C3=A1n wrote:
>>> 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
>>>
>>
>>
>
>
> --
> DrMajorBob at yahoo.com
>



  • Prev by Date: Re: Re: First function debug help
  • Next by Date: Re: Re: Initialization problem in a DynamicModule
  • Previous by thread: Re: Initialization problem in a DynamicModule
  • Next by thread: Re: Initialization problem in a DynamicModule