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