3 Replies Latest reply on May 18, 2018 4:11 AM by YesThisIsDog

    Adding scroll to dialog window

    YesThisIsDog Level 1

      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.

        • 1. Re: Adding scroll to dialog window
          Marc Autret Level 5

          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

          1 person found this helpful
          • 2. Re: Adding scroll to dialog window
            S Hopkins Adobe Community Professional

            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

            • 3. Re: Adding scroll to dialog window
              YesThisIsDog Level 1

              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