我有XML格式的用户界面:
<HBox layout:Column-cols="[-1,140,100,100,60,120,100,-1]">
<Widget />
<Text name="'name1'" text="'img.png'" />
<Text name="'good1'" text="'1'" />
<Text name="'bad1'" text="'9'" />
<Text name="'all1'" text="'10'" />
<Text name="'average1'" text="'0.980'" />
<Button name="'response1'" text="'Посмотреть'" defaults="'TableButton'" />
<Widget />
</HBox>
我尝试创建一个动态结构,但是在job参数中有一个问题,包括来自父级和函数的列,按下按钮。它是如何在stablex中实现的? (P.Sml结构类似于演示界面示例)。
在Haxe代码中,我确实喜欢这样:
var logpage:VBox = cast UIBuilder.get('logpage');
var cols:Array<Int> = [ -1, 140, 100, 100, 60, 120, 100, -1];
var Rowlog = UIBuilder.create(HBox, {
//cast(Rowlog.layout, Column).cols = cols,
children : [
UIBuilder.create(Widget, {}),
UIBuilder.create(Text, {
text : json.image,
name : 'name'+num
}),
UIBuilder.create(Text, {
text : json.good_response,
name : 'good'+num
}),
UIBuilder.create(Text, {
text : json.bad_response,
name : 'bad'+num
}),
UIBuilder.create(Text, {
text : json.response_count,
name : 'count'+num
}),
UIBuilder.create(Text, {
text : json.response_time,
name : 'time'+num
}),
UIBuilder.create(Button, {
text : 'Посмотреть',
name : '',
defaults : 'TableButton'
//on-click : goDownloadLog();
}),
UIBuilder.create(Widget, {})
]
});
logpage.addChild(Rowlog);