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

Script UI slider issue!!!

Participant ,
Jul 15, 2019 Jul 15, 2019

Copy link to clipboard

Copied

I have a strange issue with slider control. If I set the preferred width it gives decimal value, If I remove the width "works" fine!!!!!! Any idea why is this happening? You also have the same issue or it's just me?

Thank you in advance!!!

var slider1 = group1.add("slider");

slider1.minvalue = 0;

slider1.maxvalue = 100;

slider1.value = 0;

slider1.preferredSize.width = 195;

slider1.preferredSize.height = 15;

slider1.onChanging = function(){edittext2.text = this.value;};

TOPICS
Actions and scripting

Views

1.5K

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

Guide , Jul 15, 2019 Jul 15, 2019

Interesting, in ExtendScript it just increments in integers, Photoshop shows decimal points.

This can be got around by:-

var w = new Window("dialog","test",undefined,{closeButton: true});  

var group1 = w.add("group");

var slider1 = group1.add("slider");

slider1.minvalue = 0;

slider1.maxvalue = 100;

slider1.value = 0;

slider1.preferredSize.width = 195;

slider1.preferredSize.height = 15;

var edittext2 = group1.add("edittext",undefined,"0");

edittext2.preferredSize=[50,20];

slider1.onChanging = functi

...

Votes

Translate

Translate
Adobe
Guide ,
Jul 15, 2019 Jul 15, 2019

Copy link to clipboard

Copied

Interesting, in ExtendScript it just increments in integers, Photoshop shows decimal points.

This can be got around by:-

var w = new Window("dialog","test",undefined,{closeButton: true});  

var group1 = w.add("group");

var slider1 = group1.add("slider");

slider1.minvalue = 0;

slider1.maxvalue = 100;

slider1.value = 0;

slider1.preferredSize.width = 195;

slider1.preferredSize.height = 15;

var edittext2 = group1.add("edittext",undefined,"0");

edittext2.preferredSize=[50,20];

slider1.onChanging = function(){edittext2.text = this.value.toFixed(0);};

w.show();

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
LEGEND ,
Jul 15, 2019 Jul 15, 2019

Copy link to clipboard

Copied

Actually the correct answer is to use 'length' instead of 'width'.

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 ,
Jul 15, 2019 Jul 15, 2019

Copy link to clipboard

Copied

Instead of slider1.preferredSize.width? How?

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
LEGEND ,
Jul 15, 2019 Jul 15, 2019

Copy link to clipboard

Copied

Yes. Then .toFixed(0) workaround won't be needed.

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 ,
Jul 15, 2019 Jul 15, 2019

Copy link to clipboard

Copied

It doesn't work!!! Can you give an example based on my code?

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
LEGEND ,
Jul 15, 2019 Jul 15, 2019

Copy link to clipboard

Copied

LATEST

Your code is not full. So make changes to SuperMerlin code. Instead of 'width' word use 'length', and remove '.toFixed(0)'.

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