ShowWindow
Release: |
4.6 • 5.0 • 5.1 • 5.2 • 5.3 • 5.4 • 6.0 • 6.1 • 6.2 • 6.3 • 6.4 • 6.5 |
---|
Function ShowWindow opens a window in the user interface. It can be a window of any type including Diagram, Object, Result, Definition, Outline, and more.
ShowWindow(obj, windowType)
Opens a window for object «obj» in the Analytica user interface.
- «obj» may be the identifier of an object or a handle to the object.
- «windowType» is a text value, which may be any of these (it is is not case sensitive):
"Diagram"
: Show the Diagram window for «obj». When «obj» is a non-module, opens the diagram of «obj»'s parent and selects «obj» on the diagram."OnDiagram"
: Show «obj»'s parent diagram and select «obj»'s node on the diagram."Object"
: Show its Object window for «obj»."Result"
: Show its Result window for «obj». «Obj» should be a variable. It causes the variable to be evaluated, which could cause an evaluation error to display. It may open in either a table or graph view, depending on how it was most recently viewed, or on your preference settings."Graph"
: Show the graph view of a result for «obj». «Obj» should be a variable. Causes the variable to be evaluated, which could cause an evaluation error to display. If the result is not graphable (e.g., if it is a scalar), a result table might be shown instead."ResultTable"
(or just"Table"
): Show the table view of a result. «Obj» should be a variable. Causes the variable to be evaluated, which could cause an evaluation error to display."Definition"
: Shows the definition of «obj». When «Obj» is an edit table, it opens the edit table window."Outline"
: Opens the Outline window, with the hierarchy opened to the module containing «obj» and «obj» selected. You can pass Null for «obj» to open the outliner without selecting anything."Typescript"
: Opens the Typescript Window. It ignores the «obj» parameter, so use:
ShowWindow(Null,"Typescript")
Notes
It always returns Null.
This function is usually used from the OnClick expression of a button. Note that alternative options often exist for accomplishing the same thing. For example, you can insert a Module alias to provide a shortcut to a particular module, or a user output node to bring up a result.
If you select an «obj» and «windowType» combination that doesn't make sense -- e.g. try to open the 'Diagram' of a variable object -- it gives no warning. It does flag an error if «obj» is not the identifier of, or handle to, an existing object, or if «windowType» is not one of the types listed above.
If the requested window is already open, but behind other windows, ShowWindow brings it to the top. If it is iconified (aka. minimized), it un-minimizes it.
Examples
Open the diagram for Module Mo2
ShowWindow(Mo2, "diagram")
Open the result graph for Variable Y
ShowWindow(Y, "Graph")
Compute which diagram to open based on whether b
is true or false, and open it.
LocalAlias m := If b Then Handle(Mo2) Else Handle(Mo3);
ShowWindow(m, "Diagram")
When ModuleToShow has a handle of the window you want to show
Variable ModuleToShow := Handle( Mo1 )
then to show the diagram for Mo1
use
LocalAlias m := ModuleToShow Do ShowWindow(m, 'Diagram')
and not ShowWindow(ModuleToShow, 'Diagram')
, which would be asking to show the diagram for ModuleToShow.
From ADE
When evaluated in the Analytica Decision Engine (ADE), it calls IAdeUIWindowCallbacks::ShowWindow(...), from which the parent application implements the logic to jump to the requested UI window. To receive this callback, the parent application must have previously registered the callback with ADE using CAEngine::SetCallbackObject( ).
History
The functions ShowWindow and CloseWindow were added in Analytica 5.0 to replace the same functionality that was previously available using the Open and Close typescript commands. The new ShowWindow and CloseWindow functions are more convenient to use from OnClick expressions (or from UDFs called from button scripts), and reduce the need for you to learn about a separate set of Typescript commands.
See Also
- CloseWindow()
- Open command (deprecated -- use ShowWindow instead).
- Creating Interfaces for End Users
Enable comment auto-refresher