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

Adding scroll to dialog window

New Here ,
Feb 27, 2018 Feb 27, 2018

Copy link to clipboard

Copied

Hi everyone,

recently i've found this fabulous script that handles swatch changing.

But i've a little problem with it: when i have a lot of swatches (pretty often at my job) the dialog window is too big to even fit on my screen.

(Below example with random swatches).

Untitled-1.jpg

I've tried contacting author of the script but with no response. I thought that maybe i can fix this issue, but my knowledge of JS is very basic, and based mostly on jQuery and frontend developing in general.

So here is my request: Does anyone have any idea how to define max height of that window and add scrollbar to it? Or maybe change that list to dropdown list?

If my request about changing someone else code is violating any copyrights, please just let me know.

Also sorry for my english.

TOPICS
Scripting

Views

869

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 ,
Feb 28, 2018 Feb 28, 2018

Copy link to clipboard

Copied

Hi Dog,

The original UI is based on app.dialogs.add(…). This leads to what we call here a modal “DOM dialog.” Unfortunately, these DOM dialogs are poorly customizable so you won't be able to attach a scrollbar to it. But indeed the DOM provides a Dropdown object, which you can feed from an array of strings. So you could convert that huge sequence of RadiobuttonControls into a Dropdown—as you suggest. (Go into the ReplaceSwatch.jsx file and you'll find the location of the radiogroups and radiobuttons to be replaced.)

Another option would be to rewrite the whole thing using ScriptUI coding. ScriptUI provides a separate framework for laying out dialogs and controls in a much more flexible way. Since there are not many widgets in your interface (assuming we adopt the dropdown trick), ScriptUI might be a practical solution even for a beginner. To get more familiar with this approach give a read to the “Bible” authored by Peter Kahrel: ScriptUI for dummies | Peter Kahrel

And, as a bonus, here is a ScriptUI code that shows how to display colors straight in a dropdownlist:

Re: get swatches in dropdown list with color preview...

(Might be confortable if you have many many swatches to handle…)

@+

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 ,
Mar 01, 2018 Mar 01, 2018

Copy link to clipboard

Copied

Do you really have that many swatches? Looks to me like you have a problem other than the capability of your UI. (For instance I see 2 instances of a Black copy 3 with 8 swatches listed below. This is the same for a Black copy 4, a Black copy 5, and a Black copy 6. This looks like a problem with the script.)

Shirley

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
New Here ,
May 18, 2018 May 18, 2018

Copy link to clipboard

Copied

LATEST

Marc Autret​ I'm veeeery grateful, but after all this case is too overwhelming for my knowledge of coding.

But i'll definietly come back to this after some learning. Probably more for my own satisfaction and not for work.

Also thank you for that ScriptUI tutorial. Learned a lot.

S Hopkins​ it is just an example, that i did quickly just to show my problem

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