• 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 to refresh a 'disabled' tab from tabbed panel

Participant ,
Dec 27, 2016 Dec 27, 2016

Copy link to clipboard

Copied

@hi there,

Anyone knows how to disable tab from tabbed panel when clicked on a button?

I noticed that my tab does turn gray/black when it was disabled/enabled unless i clicked on it.

How to make it refresh automatically when clicked?

@

Thanks...

code below:

var w = new Window ("dialog", "test", undefined, {closeButton: false});
w.alignChildren = "right";
var tpanel = w.add ("tabbedpanel");
tpanel.alignChildren = ["fill", "fill"];
tpanel.preferredSize = [350,300];
var general = tpanel.add ("tab", undefined, "Text");
var images = tpanel.add ("tab", undefined, "Images");

var buttons = w.add ("group");
buttons.add ("button", undefined, "close", {name: "ok"});
hide = buttons.add ("button", undefined, "disable 'Images' ");
hide.onClick = function(){ 
   images.enabled =false;   
}
w.show ();

TOPICS
Scripting

Views

986

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
Community Expert ,
Dec 29, 2016 Dec 29, 2016

Copy link to clipboard

Copied

What do you mean by 'How to make it refresh automatically when clicked?'?

Peter

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
Participant ,
Jan 05, 2017 Jan 05, 2017

Copy link to clipboard

Copied

hi.. sorry for the late response.

what i meant is that when i clicked on the  disable 'Images' button, the image tab's text is still enabled until i clicked on it then it'll appear grey (disabled) state.

ideally the moment the disabled images button was clicked it should turn@ grey.

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
Participant ,
Jan 05, 2017 Jan 05, 2017

Copy link to clipboard

Copied

i'm using Indesign CS6.

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
Community Expert ,
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

Ok, I understand now and can reproduce it but have no idea how to get around it. Looks like a bug in CS6 to me. In CC2017 it works fine, must be one of the very few (ScriptUI) things that got better after CS6!

Peter

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
Participant ,
Jan 07, 2017 Jan 07, 2017

Copy link to clipboard

Copied

noted.. Thank you 

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
Guide ,
Jan 07, 2017 Jan 07, 2017

Copy link to clipboard

Copied

Hi eboda_snaf,

As often with ScriptUI this is a redraw issue. In CS4-CS6 the 'tab' widget—which by the way is a formal Panel instance—doesn't gray its label out when the enabled property changes. So you need to help it a bit. An option would be to hide() & show() the whole TabbedPanel component but that might be unnecessarily heavy. I found that temporarily changing the label (text) does the trick.

Best is to ‘prototype’ that tool:

Panel.prototype.refresh = function(  t)

{

    // Stupid op to force the tab to redraw.

    // ---

    this.text = (t=this.text) + '|';

    this.text = t;

};

Then, in your code, just add images.refresh(); after disabling/enabling.

If this doesn't work, use tpanel.hide(); images.enabled=false; t.panel.show(); instead.

@+

Marc

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
Enthusiast ,
Aug 03, 2021 Aug 03, 2021

Copy link to clipboard

Copied

LATEST

Hi, I Just Modify the Hide.onClick Function, Now it can Enable and Disable and Vice Versa :

hide.onClick = function(){ 
    if(images.enabled== true) {
    images.enabled=false; 
    hide.text = "Enable Images";
    }else{
         if(images.enabled== false) {
    images.enabled=true; 
    hide.text = "Disable Images";
        }
    }
}

 

Best
Mohammad Hasanin

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