No way to remove up to the last DesktopContainer?

Yeah but still it’s calling it to their attention.

No. Me submitting a bug report about DesktopContainer using the word “window” instead of “container” is not putting you at risk, please don’t thow aspersions like that.

Push the fact that you are creating fixed instances and want shared methods for them. There is no answer to that, almost any other way of doing things. It is how I got ManuItems as control arrays formally documented by Geoff. Once the principal is there they can be used however you like.

1 Like

I didn’t mean to cast any aspersions, I’m only half-serious about trying to keep the feature “secret”, and being self-deprecating.

1 Like

If using ControlArrays of Containers works fine, then I wonder if the “Container Arrays are not Supported” error is an obsolete holdover from an earlier time and they could just remove it?

Or perhaps easier, change the message “to set up a container Array, use the ‘Control Set’ feature found on the gear icon tab”

I’m afraid now to submit any more bug reports (mostly joking :wink: ) but perhaps you can do this if you want the feature to be official?

1 Like

Doesn’t work either. The last remaining container can’t be closed.

This requires two loops, because you can’t know how many containers are in the array. You have to make one loop to know how many there are (increment a variable until TheContainer(i) returns nil), then another loop to close them all. And then, it will fail the same way with the 0th.

And it’s still a bug about closing the 0th item.

Yes, I found it clear :wink:

I’m experimenting around this bug.

How are you creating the array?

I’m using the latest release (beta). Here’s how I’m doing it:
Insert a container in the project (name it e.g. CNT1) then drag it to a window. Finally, with the container selected in the window:
image
… set it as an array.
(I’m seeing this has already been answered in further replies here)

The only confusion I might have is control array vs control set. IMO one is just the new name for the same thing, but perhaps we’re talking about different things :man_shrugging:

This isn’t an array in code. Really several controls on the window, with the same name and different indexes, added using EmbedWithin.

I’ve seen the warning in the documentation as well (but since it’s not always up to date and there are mixes between API1 and API2, I tried anyway. And it works).

Well, except the Close method not working for the container(0) (that is, the one that must be present initially on the window so the set has a name (and just… exists)), everything else works (creating and adding others, referring them, …).
I’m believing it’s just a plain bug.

IIRC (back to the early 21st century) the official line was something like “Yes it works now but we might break it someday”. Norman would remember, too bad he was banned from this forum.

Indexes on ControlSets do not have to start at 0 and certainly don’t have to have sequential numbers.

The most they would do is loose the ability to open and close new copies. The fixed ControlSets used for shared methods is now recognised as a valid use, even by Geoff.

Well, that’s the case with other control sets; why would it be different with containers?

Also, currently, MyContainer(0) is always a valid reference in my testings.

No it isn’t. You can change the numbers to anything you want. I have a ControlSet of TextFields numbered 100, 101, 110 and 111.

As for 0, it will always be there if you have numbered one of them as 0. If you don’t it won’t.

I read Arnaud’s post as “It is the case with other control sets that they do not have to start at 0; why would it be different with containers?”

In other words, he was agreeing with you, with an added soupçon of sarcasm.

Sorry, I was disagreeing with Arnaud…

Not sure if this helps, but even in the new documentation:

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.

https://documentation.xojo.com/topics/user_interface/desktop/sharing_event_handlers_with_control_sets.html#topics-user-interface-desktop-control-sets-removing-controls-from-a-control-set-via-code

You can also use the inspector to change the indices to any integer you want. They are effectively a dictionary with integer keys, rather than an array.