From: Coleman, Mark on 11 Dec 2008 03:47 Greetings I'm working on a Manipulate-based interface that takes user input from several drop down menus (in my application there are 9 of them) and then runs a set of calculations based upon the user's choices. By default Manipulate will run the calculation every time the user changes any of the drop down menus. Ideally I'd like to have the interface not do any computation until the user makes all of their selections and then explicitly initiates the calculation (ideally using something like a 'Calculate' button). Does anyone have an example of how this might work? Thanks, Mark
From: David Park on 12 Dec 2008 06:54 Throw Manipulate in the ashcan and try something like this: Module[ {fac1 = "", fac2 = "", product = ""}, Panel[ Column[ {Row[{"Factor 1: ", InputField[Dynamic[fac1], String]}], Row[{"Factor 2: ", InputField[Dynamic[fac2], String]}], Dynamic(a)Row[{"Product: ", product}], Row[ {Button["Clear", fac1 = ""; fac2 = ""; product = ""], Button["Calculate", product = ToExpression[fac1] ToExpression[ fac2]]}] }](* Main Column *), Style["Enter and Calculate Form"] ](* Panel *) ] David Park djmpark(a)comcast.net http://home.comcast.net/~djmpark/ From: Coleman, Mark [mailto:Mark.Coleman(a)LibertyMutual.com] Greetings I'm working on a Manipulate-based interface that takes user input from several drop down menus (in my application there are 9 of them) and then runs a set of calculations based upon the user's choices. By default Manipulate will run the calculation every time the user changes any of the drop down menus. Ideally I'd like to have the interface not do any computation until the user makes all of their selections and then explicitly initiates the calculation (ideally using something like a 'Calculate' button). Does anyone have an example of how this might work? Thanks, Mark
From: jmbryant12 on 12 Dec 2008 06:58 On Dec 11, 2:47 am, "Coleman, Mark" <Mark.Cole...(a)LibertyMutual.com> wrote: > Greetings > > I'm working on a Manipulate-based interface that takes user input from > several drop down menus (in my application there are 9 of them) and then > runs a set of calculations based upon the user's choices. By default What you want is the option TrackedSymbols. By default Manipulate tracks all symbols in its contents. If you only want some of the controls to trigger updates, you can specify them. Make sure to use a delayed rule. Here's an example. Only the last 2 controls trigger an update in the output: Manipulate[ {a = a2, b = b2}, {a, 0, 4, 1}, {b, {0, 1, 2, 3, 4}}, {a2, 0, 4, 1}, {b2, {0, 1, 2, 3, 4}}, TrackedSymbols :> {a2, b2} ] Hope this helps, -Jeff Bryant Wolfram Research, Inc. > Manipulate will run the calculation every time the user changes any of > the drop down menus. Ideally I'd like to have the interface not do any > computation until the user makes all of their selections and then > explicitly initiates the calculation (ideally using something like a > 'Calculate' button). Does anyone have an example of how this might work? > > Thanks, > > Mark
From: David Reiss on 12 Dec 2008 06:59 Hi Mark, The option to Manipulate that you want to focus on here is TrackedSymbols. This will give you the behavior that you want. Best, David On Dec 11, 3:47 am, "Coleman, Mark" <Mark.Cole...(a)LibertyMutual.com> wrote: > Greetings > > I'm working on a Manipulate-based interface that takes user input from > several drop down menus (in my application there are 9 of them) and then > runs a set of calculations based upon the user's choices. By default > Manipulate will run the calculation every time the user changes any of > the drop down menus. Ideally I'd like to have the interface not do any > computation until the user makes all of their selections and then > explicitly initiates the calculation (ideally using something like a > 'Calculate' button). Does anyone have an example of how this might work? > > Thanks, > > Mark
From: sjoerd.c.devries on 14 Dec 2008 07:35 Mark, The problem with the solutions using TrackedSymbols is that the symbols that trigger the update have to be part of the thing that will be manipulated by the Manipulate construction. If they are not, they don't trigger an update. In your case, you only wanted a button that upon pressing cause the values of *other* variables to be updated. The button itself should not necessarily be connected to a variable that will be 'manipulated', i.e. will be part of the final display. The following code tricks Manipulate in doing this. As you asked for, there is a real "Continue" button, which causes the tracked symbol to change and an If statement containing a tautology involving this variable to effectuate the trigger. Try this without the If part and the symbol and you'll see the display of the variables isn't updated. I suppose there are more elegant ways to do this, but this is the best I could come up with at the moment. Cheers -- Sjoerd d = 1; Manipulate[ If[d == 1 || d != 1, {a, b, c} (* insert some useful action with your pop-up values here *)], {a, {1, 2, 3}, ControlType -> PopupMenu}, {b, {1, 2, 3}, ControlType -> PopupMenu}, {c, {1, 2, 3}, ControlType -> PopupMenu}, Delimiter, Button["Continue", d = -d], TrackedSymbols :> {d} ] On Dec 11, 10:47 am, "Coleman, Mark" <Mark.Cole...(a)LibertyMutual.com> wrote: > Greetings > > I'm working on a Manipulate-based interface that takes user input from > several drop down menus (in my application there are 9 of them) and then > runs a set of calculations based upon the user's choices. By default > Manipulate will run the calculation every time the user changes any of > the drop down menus. Ideally I'd like to have the interface not do any > computation until the user makes all of their selections and then > explicitly initiates the calculation (ideally using something like a > 'Calculate' button). Does anyone have an example of how this might work? > > Thanks, > > Mark
|
Next
|
Last
Pages: 1 2 Prev: Problem with MathLink using Mathematica 7.0 Next: Sample uniformly from a simplex |