Documentation Center

Making a control visible or invisible

You can make a UI control object visible or invisible 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 invisible, it is created at run time and the space it occupies in the UI is blank. Whether a control is visible or invisible is based on its state and the conditions specified in its <visible> and <invisible> attributes in the controls.xml file. You can use this functionality to customize the visibility of a control based on conditions you specify. For example, you may want to make the Highlight Search Results control visible when search results are being displayed and invisible when search results are not being displayed. To do so, add the applicable conditions to <visible> and <invisible> tags within the Highlight Search Results 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 modify the Highlight Search Results icon, locate the <control id="CVCtrl_highlightSearch" type="icon" label="true"> tag.
  3. To specify a condition under which the control is to be visible, between the element's opening and closing tags, add or edit the <visible> attribute to include a predefined condition name and status such as the following.
    <visible>
    				<condition name="searchResultActive" status="true"/>
    </visible>
    In this example, the icon will be visible if the condition searchResultActive evaluates to true, indicating that search results are being displayed.
  4. To specify a condition under which the control is to be invisible, between the element's opening and closing tags, add or edit the <invisible> attribute to include a predefined condition name and status such as the following.
    <invisible default="1">
    				<condition name="searchResultActive" status="false"/>
    </invisible>
    In this example, the icon will be invisible if the condition searchResultActive evaluates to false, indicating that search results are not being displayed.
  5. Save and close the controls.xml file.