TabNavigator 不显示子项

发布于 2024-09-15 19:30:47 字数 827 浏览 3 评论 0原文

我有一个 TabNavigator 组件,在运行时添加子组件时不显示其子组件。

请问有办法解决这个问题吗?

我现在正在做以下事情:

var tabNavigator:TabNavigator = new TabNavigator();

// etc.

parentHBoxContainer.addChild(tabNavigator);

 // etc.

// Custom component with nothing special in it

// Trigger on a button click (Add)
var myComponent:MyComponent = new MyComponent();

var nextTabIndex:int = tabNavigator.getChildren().length;
tabNavigator.addChild(myComponent);

// I see some text flashing but the current tab stays the same
// No text is added
tabNavigator.validateNow(); 

tabNavigator.selectedIndex = nextTabIndex;

抱歉大家没有提供足够的细节。 tabNavigator 位于 HBox 容器内,我没有添加代码,因为我认为它是无关紧要的。

我在上面的代码中将 SimpleComponent 替换为 MyComponentMyComponent 只是另一个带有文本字段和标签的 HBox

谢谢。

I have a TabNavigator component which is not showing its children when adding them at runtime.

Is there a way around this please?

I'm doing the following at the moment:

var tabNavigator:TabNavigator = new TabNavigator();

// etc.

parentHBoxContainer.addChild(tabNavigator);

 // etc.

// Custom component with nothing special in it

// Trigger on a button click (Add)
var myComponent:MyComponent = new MyComponent();

var nextTabIndex:int = tabNavigator.getChildren().length;
tabNavigator.addChild(myComponent);

// I see some text flashing but the current tab stays the same
// No text is added
tabNavigator.validateNow(); 

tabNavigator.selectedIndex = nextTabIndex;

Sorry guys for not giving enough details. The tabNavigator is inside an HBox container, I didn't add the code because I thought it would be irrelevant.

I replaced SimpleComponent by MyComponent in the code above. MyComponent is just another HBox with a textfield and a label.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

Spring初心 2024-09-22 19:30:47

尝试把这个:

tabNavigator.addChild(myComponent);

tabNavigator.selectedChild = myComponent;

而不是这个:

var nextTabIndex:int = tabNavigator.getChildren().length;
tabNavigator.addChild(myComponent);

// I see some text flashing but the current tab stays the same
// No text is added
tabNavigator.validateNow(); 

tabNavigator.selectedIndex = nextTabIndex;

Try to put this:

tabNavigator.addChild(myComponent);

tabNavigator.selectedChild = myComponent;

instead of this:

var nextTabIndex:int = tabNavigator.getChildren().length;
tabNavigator.addChild(myComponent);

// I see some text flashing but the current tab stays the same
// No text is added
tabNavigator.validateNow(); 

tabNavigator.selectedIndex = nextTabIndex;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文