Copy link to clipboard
Copied
When clicking on the 'Group Invert' button; the button remains active and nothing happens when the follow script is applied to a group.
var ui = new Window ("dialog");
var uiConvert = ui.add("button",undefined,"Group Invert");
var uiFind = ui.add("button",undefined,"Group Finder");
ui.orientation = "row";
ui.show();
uiConvert.onClick = function() {
var mDoc = app.documents[0];
var nGroup = mDoc.groupItems[0].selected;
if (nGroup >= 0) {
app.executeMenuCommand("ungroup");
}
};
ui.show() must be placed after uiConvert.onClick event handler:
var ui = new Window("dialog");
var uiConvert = ui.add("button", undefined, "Group Invert");
var uiFind = ui.add("button", undefined, "Group Finder");
ui.orientation = "row";
uiConvert.onClick = function() {
var mDoc = app.documents[0];
var nGroup = mDoc.groupItems[0].selected;
if (nGroup >= 0) {
app.executeMenuCommand("ungroup");
}
}
ui.show();
everything else is good
Copy link to clipboard
Copied
ui.show() must be placed after uiConvert.onClick event handler:
var ui = new Window("dialog");
var uiConvert = ui.add("button", undefined, "Group Invert");
var uiFind = ui.add("button", undefined, "Group Finder");
ui.orientation = "row";
uiConvert.onClick = function() {
var mDoc = app.documents[0];
var nGroup = mDoc.groupItems[0].selected;
if (nGroup >= 0) {
app.executeMenuCommand("ungroup");
}
}
ui.show();
everything else is good
Copy link to clipboard
Copied
The UI has to encapsulate everything
Although why does the button after triggered stay enabled or "blue" ?
Copy link to clipboard
Copied
I think it's a good questions to Adobe developers
Copy link to clipboard
Copied
Oh, maybe they can answer ?
Copy link to clipboard
Copied
I think that behaviour of event handlers and function Window.show() - it's a norm for Illustrator ExtendScript.
The blue color of the last pushed button does not a bug - it's a feature of the Illustrator cc2017 !
Copy link to clipboard
Copied
Thanks for the tip