Tag Info

New answers tagged


CreatePalette[{"Square root",PasteButton[Sqrt@\[SelectionPlaceholder]]}]


One way, based on the self-delete example in the documentation for Button: Button["Start", SelectionMove[ButtonNotebook[], All, GeneratedCell]; NotebookDelete[ButtonNotebook[]]; Print[Plot[x^3, {x, -1, 1}]]]


I'm guessing that you want to produce an interactive application in which the user changes any of a set of parameters and then clicks on a button to indicate that the new parameters are to applied. That sort of thing is usually done within a Manipulate expression. Here is an simple example of such an expression -- a solver for quadratic equations. ...


In the documentation of Button, under Options -> Method, it says: By default, button functions are evaluated on a preemptive link and time out after 5 seconds: DynamicModule[{a = "start"}, {Button["does time out", Pause[6]; a = "end"], Dynamic[a]}] Use Method->"Queued" to evaluate button functions on the main link, which never times out: ...


Is this what you want? doStuff := Module[{}, (* do stuff *)]; Button["Do stuff", doStuff] Here you can put whatever you want in doStuff.


DynamicEvaluationTimeout and Style may be used to locally set the dynamic timeout bound: DynamicModule[{a = "start"}, Style[{ Button["does time out", Pause[6]; a = "end"], Dynamic[a]}, DynamicEvaluationTimeout -> 10]]

Top 50 recent answers are included