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

ScriptUI: How do I un-highlight a button that was just clicked?

Engaged ,
Sep 18, 2017 Sep 18, 2017

Copy link to clipboard

Copied

   When a user clicks on a button, it remains highlighted in blue (to show it was the last button clicked). I'd like to be able to un-highlight it in my onClick callback. Does anyone know how to accomplish that?

TOPICS
Scripting

Views

511

Translate

Translate

Report

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

Valorous Hero , Sep 18, 2017 Sep 18, 2017

Use

this.active = true; this.active = false;

in your onClick function:

#target illustrator

function test(){

var counter = 0;

  var w = new Window("dialog");

  var btn1 = w.add("button", undefined, "Test 1");

  var btn2 = w.add("button", undefined, "Test 2");

  var e = w.add("edittext", undefined, "");

  e.characters = 10;

  btn1.onClick = function(){

    e.text = "Click Count: " + (counter++);

    this.active = true;

    this.active = false;

  }

  w.show();

};

test();

Votes

Translate

Translate
Adobe
Valorous Hero ,
Sep 18, 2017 Sep 18, 2017

Copy link to clipboard

Copied

LATEST

Use

this.active = true; this.active = false;

in your onClick function:

#target illustrator

function test(){

var counter = 0;

  var w = new Window("dialog");

  var btn1 = w.add("button", undefined, "Test 1");

  var btn2 = w.add("button", undefined, "Test 2");

  var e = w.add("edittext", undefined, "");

  e.characters = 10;

  btn1.onClick = function(){

    e.text = "Click Count: " + (counter++);

    this.active = true;

    this.active = false;

  }

  w.show();

};

test();

Votes

Translate

Translate

Report

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