»User: »Password:   Remember Me? 
ScriptUI Forums / ScriptUI / ScriptUI Q&A / Margins ?
Posted:  26 May 2009 21:19
Ok, i'm starting to understand how script UI works, and RapidUI is really helping.

I'm now having difficulties to have elements next to each other with no margins.

Every margin values are at 0 (i've got a window and 2 icoButtons), i define the size and position manually, but no matter what i enter, my buttons still have margins and i don't know how to get rid of this.

The generated code looks something like this:

Code:


var rapidDlg = new Window('palette',"MyToolBar",undefined,{resizeable:false});
buildWindow();
rapidDlg.show();

function buildWindow(){
    rapidDlg.minimumSize= [64,32];
    rapidDlg.maximumSize= [64,32];
    rapidDlg.preferredSize.width = 64;
    rapidDlg.preferredSize.height = 32;
    rapidDlg.alignChildren = [' ','top'];
    rapidDlg.orientation = "row";

// Properties for rapidDlg.Btn_Import
    rapidDlg.Btn_Import = rapidDlg.add('iconbutton',undefined,"D:\\Data\\St_ico_off.png", {style:'toolbutton'});
    rapidDlg.Btn_Import.alignment = [' ','top'];
    rapidDlg.Btn_Import.minimumSize= [32,32];
    rapidDlg.Btn_Import.maximumSize= [32,32];
    rapidDlg.Btn_Import.preferredSize.width = 32;
    rapidDlg.Btn_Import.preferredSize.height = 32;
    rapidDlg.Btn_Import.size= [32,32];

// Properties for rapidDlg.Btn_Config
    rapidDlg.Btn_Config = rapidDlg.add('iconbutton',undefined,"D:\\Data\\Opt_ico_off.png", {style:'toolbutton'});
    rapidDlg.Btn_Config.alignment = [' ','top'];
    rapidDlg.Btn_Config.location= [32,0];
    rapidDlg.Btn_Config.minimumSize= [32,32];
    rapidDlg.Btn_Config.maximumSize= [32,32];
    rapidDlg.Btn_Config.preferredSize.width = 32;
    rapidDlg.Btn_Config.preferredSize.height = 32;
    rapidDlg.Btn_Config.size= [32,32];

}

Posted:  27 May 2009 03:25   Last Edited By: admin
Your code doesn't display properly on my computer. This is a common problem when setting the size manually
setting the size manually shoud be more the exception then the rule.

Margins control the space on the between the end of the text or picture and the button edge. what you want to control is the spacing property of the parent.

One important point about Rapid ScriptUI, the default setting of margin is 0,0,0,0 but really when left like that no code is written and layout manager figures out what type of margin. if you want a real 0 margin then set margin to 1 then in the produced code change 1 to 0 should give you 0 margin.
Posted:  28 May 2009 12:52
Yes that's what i found out after looking more deeply into the code generated. I have to do the same workaround if i want an abject to be justified on left.
And now i do preview it directly inside After Effects, faster for me to see the result of any property (I want the UI to be a dockable palette, so for exemple, the code above displays correctly with no margins inside an AE dockable palette)

I'm really enjoying designing interface now. It was a hell of a thing for me before I started using RapidScriptUI.

BTW i've found a bug. If you create a simple Text object, and if you add text like that: Use the "opt" button to configure the option. then the generated code won't work because the doublequote are interpreted, the code does not generate the "\" escape character.
Posted:  04 Jun 2009 19:43
as of version 1.106 the margins property and spacing now accept a 0 value. the default has been changed to -1

As to your bug. The documentation makes aware of these types of issues, and we'd prefer not to generate escape characters, so the user will just add it in in these cases. Besides there are times when this can be used as an advanced feature to write actual js code as documented
Thanks