Control Set master properties (Xojo IDE)

Is there a way to set a control set’s properties so that it’s members are the same without having to set each member’s properties individually?

I can’t seem to select the ControlSet separately in the IDE, just each member.

Set them in the open event … this event is shared by all members of the set

1 Like

depends on “when”
if you create them all then select a bunch all the properties that are common cane be, or should be, settable in the inspector
if you mean at the time you add each member then no not really

Copy. Odd, but then again control sets are odd!. :slight_smile:

I know some folks swear by them
I never (and I mean NEVER) use them

1 Like

I love 'em.

If youre writing code that does something like

   select case index 
       case 1 // handle index 1
       case 2
       case 3
   end select

in the action event or others just know that this is fragile
Adding a new control to the set in the beginning or middle of the sequence will mean you have bugs to hunt down
I tend to subclass to do this kind of specialization as its less fragile
I can move add or remove controls & not worry about indexes not matching up

Up until recently, I used the index in the event method to look at properties of the individual control that triggered the event. I didn’t realize that even though it’s a shared event, it’s called by the individual control, so Me actually points to the control that the event came from.

e.g. In the Action(index as Integer) event, I don’t have to do:
MsgBox("Button Text = " + Buttons(index).Caption)
I can just do:
MsgBox("Button Text = " + Me.Caption)

So, you may not need to use the index as much as you think, if each control in the group already has different properties. You could probably get tricky with a custom property and never need use the index at all!

(Learned this from the Xojo DatePicker Example)

Yes
If its only property differences thats one use case
Often though index is used to determine how a control should behave or how code should behave based on the index. And in that case that is where I subclass and put those special behaviours in a subclass instead of just using a select case based on the index

1 Like