Trying to figure out how to build some UI that uses nested TabPanes but can't seem to figure it out. I can create a tab pane and add tabs to it no problem. If I make one of those tabs to have a TabPane with tabs, it doesn't show up:
Tab that has a tab pane to be added to the main tab pane:
Tab
{
text = "UserAPI";
EdgePane
{
center = TabPane
{
makeGetTab(table)
}
},
}
The method makeGetTab i've tested out by adding that tab Widget directly to the main tab pane and it shows up exactly as expected but the tab with the sub tab pane only shows the text and a blank tab.
What am I doing wrong?
SlimerDudeThu 15 Sep 2016
In your code, do you have a comma after the closing Tab bracket?
Tab
{
...
}, <--- this comma
The comma is a shortcut for add(...), without it the Tab obj may get created but not used - though it should give a compilation err.
Other than that, I'm not sure. The following works fine for me:
using fwt
class Example {
Void main() {
Window {
title = "Tab Demo"
TabPane {
Tab {
text = "Outer Tab"
TabPane {
Tab {
text = "Inner Tab"
},
},
},
Tab {
text = "Outer Tab2"
TabPane {
Tab {
text = "Inner Tab2"
},
},
},
},
}.open
}
}
I see a window with 2 outer tabs, each with an inner tab.
jhughesThu 15 Sep 2016
Thanks, I think I was missing a , somewhere in there. Didn't realize that's what it was doing. Manged to update my code and make it work.
SlimerDudeFri 16 Sep 2016
Cool. You can read more about the comma operator under Expression - Shortcuts. It's taken from how you define lists:
a := Int[1,2,3]
b := Int[].add(1).add(2).add(3)
It allows Fantom to be more declarative, but as you've found out, it needs special attention when adding complex objects.
jhughes Thu 15 Sep 2016
Trying to figure out how to build some UI that uses nested TabPanes but can't seem to figure it out. I can create a tab pane and add tabs to it no problem. If I make one of those tabs to have a TabPane with tabs, it doesn't show up:
Tab that has a tab pane to be added to the main tab pane:
The method makeGetTab i've tested out by adding that tab Widget directly to the main tab pane and it shows up exactly as expected but the tab with the sub tab pane only shows the text and a blank tab.
What am I doing wrong?
SlimerDude Thu 15 Sep 2016
In your code, do you have a comma after the closing Tab bracket?
The comma is a shortcut for
add(...)
, without it theTab
obj may get created but not used - though it should give a compilation err.Other than that, I'm not sure. The following works fine for me:
I see a window with 2 outer tabs, each with an inner tab.
jhughes Thu 15 Sep 2016
Thanks, I think I was missing a
,
somewhere in there. Didn't realize that's what it was doing. Manged to update my code and make it work.SlimerDude Fri 16 Sep 2016
Cool. You can read more about the comma operator under Expression - Shortcuts. It's taken from how you define lists:
It allows Fantom to be more declarative, but as you've found out, it needs special attention when adding complex objects.