Skip to content

margin not respected #14

@kevinresol

Description

@kevinresol
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);
		}
		
	}
}

Screenshot 2020-06-20 at 6 05 50 PM

Note that in the first row, only the first item has its marginLeft respected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions