DesktopWindow.Control

From Xojo Documentation

Revision as of 19:07, 23 July 2021 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Method

DesktopWindow.Control(index As Integer) As DesktopControl

New in 2021r3

Supported for all project types and targets.

The zero-based way to lookup controls in the window.

Notes

All controls on the window are returned as an Object base type. You can use the IsA operator to check the specific type to see if the control is a PushButton, Label, etc.

Example

This example is in the Pressed event of a DesktopButton and displays the name of the first control in Window:

MessageBox(Self.Control(0).Name)

Loop through all the controls on a Window and disable only the TextFields:

Var c As Object
For i As Integer = 0 To Self.ControlCount - 1
c = Window.Control(i)
If c IsA TextField Then
TextField(c).Enabled = False
End If
Next

See Also

Controls Iterator