ScriptUI resizing
Hi ![]()
I'm working on a simple conversion tool for indesign to html5. It begins to do the job but I have some problems with the UI.
First one: when I click on the "New" button, the new "tagLine" appears always at the bottom of the stack. Is there a way to make it appears just below the "tagLine" on wich I click?
Next one: when I click on the "Delete" button, the "tagLine" is well removed but others "tagLines" stay at their places. Is there a way to rearrange the remaining "tagLines" withouth the empty spaces?
Any help welcome ![]()
A picture is always better than a long speach:
The script:
var count = 0;
var lineUI = new Array();
var myPalette = new Window('palette', 'Ma palette');
initializePalette();
newTagLine();
myPalette.show();
function initializePalette() {
if (myPalette != null) {
var defaultButtons = myPalette.add('group', undefined, 'defaultButtons');
defaultButtons.orientation = 'row';
defaultButtons.alignment = 'right';
defaultButtons.cancelBt = defaultButtons.add('button', undefined, 'Cancel', {name: 'cancel'});
defaultButtons.cancelBt.onClick = function () { myPalette.close(); };
defaultButtons.startBt = defaultButtons.add('button', undefined, 'Start Process', {name: 'start'});
defaultButtons.startBt.onClick = function () { myPalette.close(); ParagraphStylesManagment(app.selection[0].parentStory.paragraphs); };
myPalette.layout.layout(true);
myPalette.layout.resize();
}
}
function newTagLine() {
if (myPalette != null) {
var i = count;
var myUiLineName = 'lineUI' + count;
lineUI = myPalette.add('group', undefined, myUiLineName);
lineUI.orientation = 'row';
lineUI.upperTagName = lineUI.add('dropdownlist', undefined, ['--- none ---', 'book', 'part', 'chapter', 'section', 'sub-section', 'sub-sub-section', 'ol', 'ul']);
lineUI.upperTagName.selection = 0;
lineUI.tagName = lineUI.add('dropdownlist', undefined, ['--- none ---', 'h1', 'h2', 'h3', 'li', 'p']);
lineUI.tagName.selection = 0;
lineUI.letterSizeStatus = lineUI.add('checkbox', undefined, 'Size');
lineUI.letterSize = lineUI.add('edittext', undefined, '');
lineUI.letterSize.characters = 3;
lineUI.familyStatus = lineUI.add('checkbox', undefined, 'Family');
lineUI.family = lineUI.add('edittext', undefined, '');
lineUI.family.characters = 10;
lineUI.fontStyleStatus = lineUI.add('checkbox', undefined, 'FontStyle');
lineUI.fontStyle = lineUI.add('edittext', undefined, '');
lineUI.fontStyle.characters = 10;
lineUI.catchBt = lineUI.add('button', undefined, 'Catch', {name: 'catchTag'});
lineUI.catchBt.onClick = function () { catchTagProperties(i); };
lineUI.newBt = lineUI.add('button', undefined, 'New', {name: 'newTag'});
lineUI.newBt.onClick = function () { newTagLine(); };
lineUI.deleteBt = lineUI.add('button', undefined, 'Delete', {name: 'deleteTag'});
lineUI.deleteBt.onClick = function () { deleteTagLine(i); };
myPalette.layout.layout(true);
myPalette.layout.resize();
count += 2;
}
}
function deleteTagLine(counter) {
lineUI[counter].hide();
myPalette.layout.layout(true);
myPalette.layout.resize();
}
