DynamicModule and InheritScope
- To: mathgroup at smc.vnet.net
- Subject: [mg79476] DynamicModule and InheritScope
- From: Christian <christian_chong-white at rta.nsw.gov.au>
- Date: Fri, 27 Jul 2007 06:00:35 -0400 (EDT)
Hi All.
My question relates to InheritScope option of DynamicModule. I am
having trouble using the dynamic functionality within functions in a
functional programming 'way'.
To demonstrate:
Mathematica help (Advanced Dynamic Functionality) provides an example
as follows:
DynamicModule[{x = 1}, {Button["+", ++x],
Button["Make - Palette",
CreatePalette[
DynamicModule[{}, Button["-", --x], InheritScope -> True]]],
Dynamic[x]}]
For example, I am wanting to use the above but as nested function as
follows. The issue is that this code does not work.
test[in_] :=
DynamicModule[{x = 1}, {Button["+", ++x],
Button["Make - Palette", in[]], Dynamic[x]}]
test2[] :=
CreatePalette[
DynamicModule[{}, Button["-", --x], InheritScope -> True]]
test[test2]
Can anyone explain to me why this doesn't work and a remedy.?
Big cheers and thanks
Christian