Home > Language Reference > Classes > Control

Layer Property

Layer to which the control belongs.

Syntax

Public Property Get Layer() As Integer

Remarks

A layer is a simple way of logically grouping controls on a form. This greatly helps to design complex dynamic dialog boxes, such as tabbed dialogs.

At design time, the Layer Window tool allows you to hide and show layers. Controls belonging to a visible layer are displayed normally in the form editor, and they can be selected, moved, resized, and so on; controls belonging to an hidden layer are grayed, and they cannot be selected nor edited. To assign a layer to a control, simply edit its Layer property. Layers are numbered from 0 to 255. Unused layers do not appear in the Layer Window list.

At run time, the Controls function can be used to populate a Collection object with all the controls in a given layer of a form. You can then loop over the members of this collection to perform any required operation. The following example hides all the controls belonging to the layer #9:

Private Sub Button1_Click()
  Dim c As Control
  
  For Each c In Controls(9)
    c.Visible=False
  Next
End Sub

This property is read-only. It can only be modified at design time, using the Property Window.

System requirements

SystemMinimal versionRemarks
Palm OSPalm OS 3.0N/A