Re: GUIKit
- To: mathgroup at smc.vnet.net
- Subject: [mg50789] Re: [mg50714] GUIKit
- From: Jeff Adams <jeffa at wolfram.com>
- Date: Tue, 21 Sep 2004 03:49:06 -0400 (EDT)
- References: <200409180948.FAA00462@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Sep 18, 2004, at 4:48 AM, Bill Collins wrote: > I have been playing with the new GUIKit. I have attempted to modify > one > of the examples (RealTimePlotting) by inserting a second slider with an > additional parameter conrolling the equation. After trying several > combinations I cannot get it to work. Do I use two Script commands and > separate sliderFunc definitions for each parameter? Any hint would be > helpful. > > Bill Collins > wccollins at starband.net Hi Bill, Here is a simple extended version of that example with three sliders controlling three different parameters. This is just one way you could design something that should scale for an arbitrary number of sliders or other control widgets. Thanks Jeff Adams Wolfram Research ----- GUIRunModal[ Widget["Panel", { {Widget["Label", {"text" -> "a:"}], Widget["Slider", {BindEvent["change", Script[updatePlot[]; ]]}, Name -> "aSlider", WidgetLayout -> {"Stretching" -> {Maximize, False}}]}, {Widget["Label", {"text" -> "b:"}], Widget["Slider", {"value" -> 3, "minimum" -> 1, "maximum" -> 15, BindEvent["change", Script[updatePlot[]; ]]}, Name -> "bSlider", WidgetLayout -> {"Stretching" -> {Maximize, False}}]}, {Widget["Label", {"text" -> "c:"}], Widget["Slider", {"value" -> 10, "minimum" -> 1, "maximum" -> 15, BindEvent["change", Script[updatePlot[]; ]]}, Name -> "cSlider", WidgetLayout -> {"Stretching" -> {Maximize, False}}]}, Widget["MathPanel", { "preferredSize" -> Widget["Dimension", {"width" -> 288, "height" -> 288}]}, Name -> "canvas", WidgetLayout -> {"Stretching" -> {True, Maximize}}], Widget["TextArea", {"text" -> "Plot[Sin[b/10 x]^a,{x, 0, c Pi}]", "rows" -> 3}, Name -> "plotStringText"], "preferredSize" -> Widget["Dimension", {"width" -> 288, "height" -> 340}], BindEvent["componentResized", Script[updatePlot[]; ]], BindEvent["endModal", Script[expr]], Script[ updatePlot[] := Block[{a, b, c, $DisplayFunction = Identity}, a = Round[ToExpression[PropertyValue[{"aSlider", "value"}]]/10]; b = ToExpression[PropertyValue[{"bSlider", "value"}]]; c = ToExpression[PropertyValue[{"cSlider", "value"}]]; expr = ToExpression[PropertyValue[{"plotStringText", "text"}]]; expr = Show[expr, PlotRange -> All]; SetPropertyValue[{"canvas", "mathCommand"}, ToString[expr, InputForm]]]; updatePlot[]; ] }] ]
- References:
- GUIKit
- From: "Bill Collins" <wccollins@starband.net>
- GUIKit