ChangeNodeVisibility
new to Analytica 5.0
ChangeNodeVisibility( obj, option, what )
You can use this function to make a node hidden, visible, or disabled. This can be used from OnChange attributes in a user interface to produce dynamic user interfaces that alter that state of other controls as a user enters information. You can also use this function to query the current visibility state of the node.
The «obj» parameter is a handle to the node that you want to change or query. When «what» is omitted, then «obj» is the node whose visibility is being changed (or queried). Or you can pass a handle to a variable to «obj» and set «what» to 'UserInputs'
or 'UserOutputs'
to change the visibility of all inputs or all outputs of a node. If you want to changed the visibility of a single user input or user output node, then you should ensure that this is a handle to the user input node, not a handle to the original variable node, and that «what» is omitted. You can also pass 'Original'
to «what» to change the visibility of the original (not the alias) of «obj».
Change the visibility state by setting «option» parameter to one of the following:
"Visible"
or"Enabled"
: Change the node into a visible enable state. The two options are synonymous, but if your interface is hiding and showing, it may be clearer to use"Visible"
, while if it is disabling and enabling then using"Enabling"
is clearer."Hidden"
: Hide the node on the diagram. The node will still be present in the Outline window, can be found from the Find Dialog, and you can get to its Object Window, or from hyperlinks to it that might be displayed in result windows, or in inputs and outputs of other variables, etc. It also remains selectable on the diagram in edit mode, even though it is invisible."Disabled"
: Put the node into a visible but disabled state. It will appear in a gray flush state and not respond to the user's input.
There are a few additional, but less common, options:
"Very hidden"
: Set to not show up on the diagram, in the Outline window, hierarchy stripe, Find Dialog, etc., so that it basically appears to the end-user as if it doesn't exist. However, you can still hyperlink to it if a hyperlink exists."Extremely hidden"
: Set so that you can't reach the node via existing hyperlinks get to it from the Analytica UI in general."Hidden in browse"
: Make the node is present and visible is edit mode, but does not appear on the diagram in browse mode."Disabled in browse"
: Make the node disabled in browse mode. It is enabled in edit mode.
You can also query the current visibility state using these options, all containing a question mark in the option name:
"Is Visible?"
: Returns true if the node is visible, and true if disabled but visible. False if not visible on influence diagram."Is Hidden?"
: Returns true if the node is hidden (not visible), true otherwise."Is Disabled?"
: Returns true if the node is hidden or disabled. True if visible and enabled."Is Enabled?"
: Returns true if the node is visible and enabled. False otherwise."How hidden?"
: Returns the option text describing the visibility state;"Visible", "Hidden", "Hidden in browse", "Very Hidden", "Extremely hidden", "Disabled",
or"Disabled in browse"
.
When you query the visibility state and specify «what» to be 'UserInputs'
or 'UserOutputs'
, the result is a 1-D array with a local index, where the local index contains the handles of each user input or each user output node, and the value is the result for that node.
Examples
Hide, show, disable or re-enable the user inputs for variable Gender
:
- ChangeNodeVisibility( Handle(Gender), 'Hidden', 'UserInputs' )
- ChangeNodeVisibility( Handle(Gender), 'Visible', 'UserInputs' )
- ChangeNodeVisibility( Handle(Gender), 'Disabled', 'UserInputs' )
- ChangeNodeVisibility( Handle(Gender), 'Enabled', 'UserInputs' )
Hide your model details module node from your end user:
- ChangeNodeVisibility( Handle(Model_details), 'Hidden in browse' )
Enable comment auto-refresher
Marksmith