GUIKit tool to select frames
- To: mathgroup at smc.vnet.net
- Subject: [mg73504] GUIKit tool to select frames
- From: Guy lamouche <no at public.email.com>
- Date: Tue, 20 Feb 2007 06:22:14 -0500 (EST)
Hi, below is a very naive attempt at using the GUIKit to plot a selected frame of an ensemble of frames. The variable Global`data in plotDialog[] is a Matrix containing 100 frames of 250 x 250 (Real numbers), it is obviously defined outside plotDialog[]. PlotDialog opens a window, display a frame selected by the slider. This was built by modifying the plotgroupdialog and slider in the GUIKit examples. The code looks horribly formatted below, but it looks a very little bit better when pasted in Mathematica. Question: It is very slow with my 100X250X250 matrice when changing the display from one frame to another, can someone effective un GUIKit programming suggest a change that would make it more responsive? Thanks in advance. Guy Lamouche plotDialog=[] := GUIRunModal[Widget["Panel", WidgetGroup[{Widget["MathPanel", {"preferredSize" -> Widget ["Dimension", {"width" -> 150, "height" -> 150}], "usesFE" -> True}, WidgetLayout -> {"Stretching" -> {Maximize, Maximize}}, Name -> "canvas"], WidgetGroup[{Widget["TextField", {"text" -> "", "columns" -> 3, "editable" -> False}, Name -> "textField"], Widget["Slider", {BindEvent["change", Script[SetPropertyValue [{"textField", "text"}, ToString[PropertyValue[{"slider", "value"}], InputForm]]]], BindEvent["change", Script[updatePlot[]]]}, Name -> "slider"]}, WidgetLayout -> Row], BindEvent["componentResized", Script[updatePlot[]]], BindEvent["endModal", Script[Show[expr]]], Script[updatePlot[] := Block[{slid, $DisplayFunction = Identity}, slid = ToExpression[PropertyValue[{"slider", value}]]; expr = Show[ArrayPlot[data[[slid,All,All]]], PlotRange -> All]; SetPropertyValue[{"canvas", "mathCommand"}, ToString[expr, InputForm]]; InvokeMethod[{"canvas", "repaintNow"}]; ]; updatePlot[]]}, WidgetLayout -> Column], WidgetLayout -> {"Stretching" -> {True, True}}], IncludedScriptContexts -> {$Context}]