[ALOY-883] Support proxy-like elements in Alloy widget/require child view-elements
|Labels||alloy, children, require, views, widgets|
- Ronald Treur 2013-11-22
I might misunderstand this completely Fokke, so just taking a shot here.
I get the impression you simply want an extra element to group other UI elements, but perhaps without adding an extra UI layer? If correct, then something like the example below might make sense. This Container is to behave like a basic View in many ways, except when rendering it, then it should:
A) simply get out of the way and directly render its children, or
B) if the widget didn't actually "do" anything with it, it's children should not be rendered at all
If I'm completely off here, please clarify ;-)
<Alloy> <Window> <Widget id="myWidget" src="myWidget"> <Label id="childA" /> <Container id="someproxy"> <Label id="childB1" /> </Container> <Container id="anotherproxy"> <Label id="childC1" /> <Label id="childC2" /> </Container> <Label id="childD" /> </Widget> </Window> </Alloy>
- Fokke Zandbergen 2013-11-22
[~ronaldtreur] yes, you could do it like that as well, having just a single
<Container />element for this purpose, but then at least another attribute then
idshould be used to name it, because that's exactly what I find non-descriptive about the referenced example in the Alloy repo. I'd rather name it through the tag name, because I think that is most clear.
- Ronald Treur 2013-11-22 I agree that custom semantic tags would trump non-descriptive ones! Then by default these non-standard elements should not render, simply let the widget figure out what to do with it. If implementing custom tags proves difficult, then using a single new element (e.g. Container) with an id might prove a nice solution in the interim I guess? Support for both would nicely mimic HTML 5, which might be a good thing since this lowers the learning curve for a great many developers.
- Tony Lukasavage 2014-01-20
How would Alloy identify a tag as a container to be passed as a named argument to
childrenversus being just another UI element it's supposed to render?
- Fokke Zandbergen 2014-01-20
There would be no other way then assuming it is when the tag is unknown and there's no
- Tony Lukasavage 2014-01-20 [~fokke] there's no way to determine that the tag is "unknown". Alloy always defers to its default renderer, which is how it is able to automatically start using new Titanium APIs when they are introduced. Since this is essentially impossible in its current incarnation I'm going to close this for now. If an alternate solution arises that does not require arbitrary tags to be interpreted in a specific way, I'll re-open it.
- Fokke Zandbergen 2014-01-21 Makes sense. I don't see a way that wouldn't be a terrible hack as well.