Skip to main content
Tweeted twitter.com/#!/StackMma/status/360182130791284737
edited title
Link
Murta
  • 26.4k
  • 6
  • 77
  • 168

Button evaluation inside dynamic moduleDynamicModule

Source Link
Murta
  • 26.4k
  • 6
  • 77
  • 168

Button evaluation inside dynamic module

Someone know why this Button works when clicked:

testModule1[]:=DynamicModule[{button, x="",randomGrid},
    button=Button["Create table",x=RandomInteger[10,{3,3}]//MatrixForm];
    Deploy@Panel@Dynamic@Column[{button,x}]
]
testModule1[]

test1

and this not:

testModule2[]:=DynamicModule[{button, x="",randomGrid,ff},
    ff:=(x=RandomInteger[10,{3,3}]//MatrixForm);
    button=Button["Create table",ff];
    Deploy@Panel@Dynamic@Column[{button,x}]
]
testModule2[]

test2

I have some big functions to put into x, and I would like to organize my code in the second way.