Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 4 Advanced Tasks : Controlling the Visibility of a Pane Based on the Value of a Control

Controlling the Visibility of a Pane Based on the Value of a Control
You can set the visibility of a pane to be determined by the value of a control on the form, for example, an optionlist control.
Task
Control the visibility of a pane based on the value of a control.
Sample Project
To view the sample for this task, import the advanced sample projects as described in Import the Forms Advanced Samples. The sample form for the task described in this section is contained in the forms.samples.panes project.
The form (VerticalPaneVisibility.form) is at the following location:
   forms.samples.panes/Forms/Visibility/
You can double-click the form’s filename (as well as those of other project resources) in the Project Explorer to open it in the editor. There, you can examine it and use it as a model for your own projects.
Explanation
To implement this task, follow these steps:
1.
There are three vertical panes in the sample form with the names pane1, pane2 and pane3. Go to the General tab in the Properties view for each pane and clear the Visible check box.
2.
3.
Go to the Properties tab in the Properties view for the optionlist control and add the following custom labels and values as choices:
4.
While still in the Properties view for the optionlist, go to the Rules tab and create a rule for the Update event of the optionlist control.
Add the following action script code for this rule.
      var selectedPane = context.newValue;
      if ( selectedPane == "pane1") {
        //Make the pane1 visible and other panes invisible.
        pane.pane1.setVisible(true);
        pane.pane2.setVisible(false);
        pane.pane3.setVisible(false);
      } else if ( selectedPane == "pane2") {
        //Make the pane2 visible and other panes invisible.
        pane.pane1.setVisible(false);
        pane.pane2.setVisible(true);
        pane.pane3.setVisible(false);
      } else if ( selectedPane == "pane3") {
        //Make the pane2 visible and other panes invisible.
        pane.pane1.setVisible(false);
        pane.pane2.setVisible(false);
        pane.pane3.setVisible(true);
      }
5.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved