Get Array of Controls within a GroupBox?

Hi everyone!

Is there a way to get a list or an array of all controls within a groupbox?
While disabeling a groupbox won’t gray out the embedded labels in cocoa I want to write a method that does it for me. So I need to have a list of labels in the GroupBox and change there color by code.

Greetings,
Christoph

You can loop through all the controls on the Window using Window.Control and Window.ControlCount. And then check each control’s parent to see if it is the GroupBox. Perhaps something like this:

Dim c As RectControl For i As Integer = 0 To Self.ControlCount-1 If Self.Control(i) IsA RectControl Then c = RectControl(Self.Control(i)) If c.Parent = GroupBox1 Then c.Enabled = False End If End If Next

Hi Paul,

thanks for your advice, this was VERY helpful!

Greetings,
Christoph