Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

margin not respected #14

Open
kevinresol opened this issue Jun 20, 2020 · 4 comments
Open

margin not respected #14

kevinresol opened this issue Jun 20, 2020 · 4 comments

Comments

@kevinresol
Copy link
Contributor

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.

@ianharrigan
Copy link
Member

Yeah, looks off, so basically, the first row should effectively have a 30px space between each item?

@kevinresol
Copy link
Contributor Author

yup.

Also, I don't understand why there are margin between the items in the 2nd row, and seems no way to disable it.

@ianharrigan
Copy link
Member

ill take a look at the margins one,

as for the second row, there is a spacing style attribute that in the default style is "5px":

http://haxeui.org/builder/?auxkih

@kevinresol
Copy link
Contributor Author

arr ok, thanks. didn't know about the spacing style

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants