-
-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
package;
import haxe.ui.*;
import haxe.ui.core.*;
import haxe.ui.components.*;
import haxe.ui.containers.*;
class Main extends hxd.App {
static function main() {
new Main();
}
override function init() {
hxd.Res.initEmbed();
Toolkit.init({app: this});
var root = new VBox();
Screen.instance.addComponent(root);
var window = hxd.Window.getInstance();
root.width = window.width;
root.height = window.height;
root.customStyle.backgroundColor = 0x37344C;
// demonstrate margin
var box = new HBox();
root.addComponent(box);
box.customStyle.backgroundColor = 0x00ff00;
box.customStyle.percentWidth = 100;
for(i in 0...6) {
var item = new Label();
box.addComponent(item);
item.text = 'Label $i';
item.customStyle.marginLeft = item.customStyle.marginRight = 30;
item.customStyle.backgroundColor = Std.random(0xffffff);
}
// demonstrate padding
var box = new HBox();
root.addComponent(box);
box.customStyle.backgroundColor = 0xffff00;
box.customStyle.percentWidth = 100;
for(i in 0...6) {
var item = new Label();
box.addComponent(item);
item.text = 'Label $i';
item.customStyle.paddingLeft = item.customStyle.paddingRight = 30;
item.customStyle.backgroundColor = Std.random(0xffffff);
}
}
}Note that in the first row, only the first item has its marginLeft respected.
Metadata
Metadata
Assignees
Labels
No labels
