[JS] Hide Extra Space in Dynamic Script UI
when hiding/showing sections, i'm getting space don't want. haven't been able figure out how remove space.
there's post @ adapted simple example below. when section toggle on/off hidden, you'll see there space between first , second static text. there should less space (as seen between second , third static text). ideas of how avoid space?
thanks in advance.
dan
var null_size = [0,0], max_size = [1000,1000]; var u, w = new window('dialog', 'test'), p = w.add('panel'), s1 = p.add('statictext', u, "this static text"), // collapsible group g = p.add('group'), e = g.add('edittext', u, "edit text..."), r = g.add('checkbox', u, "blablablabla"), // --- s2 = p.add('statictext', u, "this more static text"), s3 = p.add('statictext', u, "this static text"), b = w.add('button', u, 'toggle'); g.orientation = 'column'; // initial state : hidden // --- g.visible = false; g.maximumsize = null_size; // toggles container's visibility // --- b.onclick = function() { g.maximumsize = (g.visible ^=1) ? max_size : null_size; w.layout.layout(true); }; w.show();
put s1, g, , s2 in group , change spacing half of current spacing when g hidden, restore spacing when g visible.
var null_size = [0,0], max_size = [1000,1000]; var u, w = new window('dialog', 'test'), p = w.add('panel'), g1 = p.add('group'); s1 = g1.add('statictext', u, "this static text"), // collapsible group g = g1.add('group'), e = g.add('edittext', u, "edit text..."), r = g.add('checkbox', u, "blablablabla"), // --- s2 = g1.add('statictext', u, "this more static text"), s3 = p.add('statictext', u, "this static text"), b = w.add('button', u, 'toggle'); g.orientation = 'column'; g1.orientation = 'column'; g1.spacing = p.spacing/2; // initial state : hidden // --- g.visible = false; g.maximumsize = null_size; // toggles container's visibility // --- b.onclick = function() { g.maximumsize = (g.visible ^=1) ? max_size : null_size; g1.spacing = g.visible ? p.spacing : p.spacing/2; // alert(g1.spacing); w.layout.layout(true); }; w.show();
More discussions in InDesign Scripting
adobe
Comments
Post a Comment