-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[POLL] Should single-child containers (uiWindow, uiGroup, uiTab pages) allow NULL children? #48
Comments
I opt for option 1. Containers which take N children (Box, Tabs) also allow to be in an empty state, so why not also allow this for containers with a single state? This is also a bit more friendly and flexible from the API users' perspective, as it allows for more flexible construction and tear down of a control hierarchy. |
Also, referring to my other issue with manually tearing down a control tree: not allowing NULL children would make it impossible to remove an object from a tree from the leaves down. |
Another option would be to disallow NULL and instead have a new control On Mon, 23 May 2016, at 08:43, Ico Doornekamp wrote:
Links: |
I'd vote for option 1, as this creates symmetry with multi child controls. |
Option 1 feels the most intuitive. |
Multi-child controls don't allow you to add NULL, as that would make little sense (the only use would be uiEmptyControl could probably just be an empty box internal to these containers. The original package ui had |
Option 1 is the best IMO. |
Current idea: Allow NULL everywhere, including uiBox and uiGrid; implicitly turn it into a dummy empty-space control. Ownership has to be maintained by the parent, but that shouldn't be too hard. How does this sound? |
Merged with #328. |
Containers that allow only one child — uiWindow, uiGroup, and the individual pages of a uiTab — have this weird intermediary state when you first create them: the state of having no child; the value of the child
uiControl
pointer isNULL
. This creates a bunch of weird edge cases for determining what the preferred size of these containers should be and certain grandparent-parent-child relationships.There are three things I can do to resolve this:
NULL
children explicitly where passingNULL
to aSetChild()
will simply produce an empty container.NULL
initially, but not afterward where creating a container has aNULL
child but that's the only timeNULL
is allowedNULL
entirely meaning that every constructor function would need you to pass a child in, even a temporary one like an empty box (I could provide a spacer control too)What do you all think? I'm genuinely not sure which I should do; all the options require relatively the same amount of code effort on my part.
The text was updated successfully, but these errors were encountered: