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

Button stays active and no action taken ?

Advisor ,
Jan 07, 2017 Jan 07, 2017

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");

}

};

TOPICS
Scripting
1.0K
Translate
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

Engaged , Jan 08, 2017 Jan 08, 2017

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

Translate
Adobe
Engaged ,
Jan 08, 2017 Jan 08, 2017

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

Translate
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
Advisor ,
Jan 08, 2017 Jan 08, 2017

The UI has to encapsulate everything

Although why does the button after triggered stay enabled or "blue" ?

Translate
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
Engaged ,
Jan 08, 2017 Jan 08, 2017

I think it's a good questions to Adobe developers

Translate
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
Advisor ,
Jan 08, 2017 Jan 08, 2017

Oh, maybe they can answer ?

Translate
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
Engaged ,
Jan 08, 2017 Jan 08, 2017

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 !

Translate
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
Advisor ,
Jan 08, 2017 Jan 08, 2017
LATEST

Thanks for the tip

Translate
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