Documentation Center

Showing or hiding a control

You can show or hide a UI control object based on a predefined condition by editing attributes of its corresponding control element in the controls.xml file.

About this task

When a control is shown, it is created at run time and occupies space on the screen. When a control is hidden, it is not created and occupies no space. A shown control may not be visible, based on its state and the conditions specified in its <invisible> and <visible> attributes in the controls.xml file. You can use this functionality to customize the availability of a control based on conditions you specify. For example, you may want to show a given control when a user selects one type of content (such as a data module), but hide it when other types of content are selected. To do so, add the applicable conditions to <shown> and <hidden> tags within the control's definition in the controls.xml file.

Procedure

  1. Open the controls.xml file in a text editor.
  2. In the controls.xml file, locate the control element corresponding to the desired UI object.
    For example, to show or hide the Print All Figures icon, locate the <control id="CVCtrl_printAllFigures" type="icon" child="true"> tag.
  3. To specify a condition under which the control is to be shown, between the element's opening and closing tags, add or edit the <shown> attribute to include a predefined condition name and status such as the following.
    <shown>
    					<condition name="hasGraphic" status="true"/>
    </shown>
    In this example, the Print All Figures icon will be shown if the condition hasGraphic evaluates to true, indicating that the currently open module contains at least one graphic.
  4. To specify a condition under which the control is to be hidden, between the element's opening and closing tags, add or edit the <hidden> attribute to include a predefined condition name and status such as the following.
    <hidden>
    					<condition name="hasGraphic" status="false"/>
    </hidden>
    In this example, the icon will be hidden if the condition hasGraphic evaluates to false, indicating that the currently open module does not contain graphics.
  5. Save and close the controls.xml file.