Remember, because Control Sets are not arrays if you remove a control in the middle of the Control Set you will get a hole in the index values. For example if you have four items in a Control Set they will initially have index values of 0, 1, 2, 3. If you remove index 2 then you will have three items in the Control Set with index values of 0, 1, 3. Index value 2 will be Nil.
Is this actually correct?
I have dynamically created a set of checkboxes. Then one or more were optionally deleted. Based on the documentation I expected holes in the list but deleting seems to close the gaps, no holes in the index sequence. Makes life a lot simpler but …
I always relied on the fact that gaps are indeed removed in this case (since 20 years of programming with “Xojo”). No idea why the documentation says otherwise.
The gaps are not automatically removed if you delete elements at design time. They never have been. In this case, if you ignore the documentation, you can introduce bugs.
One of the “facts (programming) life” I have to remind my friends about is, just because something’s in print, that doesn’t make it true. Quantum Physics aside, everything happens at a point in time and what was true at one time, may not be true later. So I always suggest that when coding for an action to happen, test it to make sure what you think happened, actually did happen.
My naivete was exposed in College Calculus class where the answers to odd numbered quiz questions (at the end of the chapter) were given in the back of the textbook. Except some of them were wrong! How could they print a calculable answer incorrectly? If it’s in print, it may be true; it may not.