• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How can I make this type of ScriptUI as you see in the model image?

Contributor ,
Feb 18, 2020 Feb 18, 2020

Copy link to clipboard

Copied

UI.jpg

 

I want to make this type of UI for my script. But It is kind of headache for me to give space between the buttons 1&2 and buttons 3&4. If I use alignment It doesn't work. Can anyone help me to achieve this??

I Can do that by introducing a statictext between 1&2 and 3&4 with bunch of spaces. But is there any simple/ procedural way to make it possible??

TOPICS
How to , Scripting , User interface or workspaces

Views

390

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Feb 19, 2020 Feb 19, 2020

This is rather a straight forward way of doing things. 

The magic here is element.alignment and parentGroup.alignChildren properties.

(function() {
	var win = new Window('palette', 'script', undefined, {
		resizeable: true
	});

	win.alignChildren = ['fill', 'top'];


	var grpLine1 = win.add('group');
	var btn1 = grpLine1.add('button', undefined, '1');
	var btn2 = grpLine1.add('button', undefined, '2');
	btn2.alignment = ['right', 'top'];


	var grpLine2 = win.add('group');
	var btnMiddle = grpL
...

Votes

Translate

Translate
Advocate ,
Feb 19, 2020 Feb 19, 2020

Copy link to clipboard

Copied

This is rather a straight forward way of doing things. 

The magic here is element.alignment and parentGroup.alignChildren properties.

(function() {
	var win = new Window('palette', 'script', undefined, {
		resizeable: true
	});

	win.alignChildren = ['fill', 'top'];


	var grpLine1 = win.add('group');
	var btn1 = grpLine1.add('button', undefined, '1');
	var btn2 = grpLine1.add('button', undefined, '2');
	btn2.alignment = ['right', 'top'];


	var grpLine2 = win.add('group');
	var btnMiddle = grpLine2.add('button', undefined, 'MIDDLE BUTTON');
	btnMiddle.alignment = ['fill', 'top'];
	btnMiddle.preferredSize.width = 300;


	var grpLine3 = win.add('group');
	var btn3 = grpLine3.add('button', undefined, '3');
	var btn4 = grpLine3.add('button', undefined, '4');
	btn4.alignment = ['right', 'top'];


	win.onResizing = win.onResize = function() {
		this.layout.resize();
	};

	win.center();
	win.show();
})();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 19, 2020 Feb 19, 2020

Copy link to clipboard

Copied

Thank you so much. I wasn't aware of element.alignChildren until now. Thank you somuch for make my life easier.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 19, 2020 Feb 19, 2020

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines