Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DynamicModule and InheritScope

2 views
Skip to first unread message

Christian

unread,
Jul 27, 2007, 6:21:20 AM7/27/07
to
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


0 new messages