9 Replies Latest reply on Jun 12, 2016 12:49 PM by pdfUser1

    PopMenu selection to change drop down field's fill color?

    pdfUser1 Level 1

      I have a popMenu button with a list of names in my doc. There are roughly 18 drop downs as well and each are associated with a particular name in the popMenu list. What I would like to do is when I select, let's say, Steve from the popMenu, then what I want to happen is all the drop downs fill colors change to the same color. Like light grey. When I select a different name from the popMenu list of names then Steve goes back to white and the name selected, let's say, Albert's drop downs turn to light blue. And so forth.

       

      The drop downs are all visible and should remain visible. The only thing that should change are the fill colors of the drop downs. Then back to white when a different name is selected. Is something like this possible? Can someone tell me the way to do this. I just don't know. I really haven't gotten into this area. Until now. I've been searching around for the answer and/or help but cannot find what I need. Thanks guys.

        • 1. Re: PopMenu selection to change drop down field's fill color?
          try67 MVP & Adobe Community Professional

          So there's a specific drop-down associated with each name in the pop-up menu?

          • 2. Re: PopMenu selection to change drop down field's fill color?
            try67 MVP & Adobe Community Professional

            If that's the case then you can use something like this (adjust the field names and other missing bits, of course):

             

            var resp = app.popUpMenu( ... );
            
            this.getField("DropdownSteve").fillColor = (resp=="Steve") ? color.ltGray : color.white;
            this.getField("DropdownAlbert").fillColor = (resp=="Albert") ? ["RGB", 135/255, 206/255, 250/255] : color.white;
            // etc.
            
            • 3. Re: PopMenu selection to change drop down field's fill color?
              pdfUser1 Level 1

              I'm running into a little curve in the road. This is the popMenu script I'm using. The script you provided is a little different than mine. I have tried it in mine and only the first name worked. I tried your script in a completely different popMenu button without any other options and it worked fine.

               

              My question is, how do I combine your script with mine (or visa versa)? I have enclosed the popMenu I'm using. As you see it's a little different. I have quite a few options also in mine. This is just a snippet of what I have. Are the two scripts completely different in the way they work? The first difference I think is the "resp" and the "case" and "break".

               

              var itemIndex = app.popUpMenu("blah", "blah", "blah", "-", ["Names","Steve", "-", "Albert", "-", "Mary", "-", "Juni"] );

              switch (itemIndex)    {

               

                  case "":

                      break;

                     

                  case "":

                      break;

               

                  case "":

                      break;

              //and so on

              }

               

              What do you think?

              • 4. Re: PopMenu selection to change drop down field's fill color?
                try67 MVP & Adobe Community Professional

                In your approach you will need to add a command to change each field in each of the cases under your switch. In my approach it handles both situations (when the matching value is selected, or when another value is selected) in the same line, so the code is much more compact. If my code worked for you, why not use it?

                • 5. Re: PopMenu selection to change drop down field's fill color?
                  pdfUser1 Level 1

                  Thanks for your input. I would use your script but like I mentioned in my other post, it doesn't work when I combine it with mine. I don't know why and I don't have the expertise to explain why it doesn't. I understand what to do with my script, but even so, that took me a long time to get it right and working. I'm still a novice at this, which is why I ask for example so I can learn.

                   

                  Yes, your script worked but only when I placed it into a new, fresh button by itself. When I tried to add the items from my script (case & switch) it then stopped. I got a bunch of error messages and that's when I replied with my other post hoping to figure it out.

                   

                  I've tried everything I know (up to this point which isn't much) to get it to do what I want. I'll play around with it a little more. I sure wish I was an expert. I'd like to get working.

                   

                  This is a bit of my knowledge example:

                  var itemIndex = app.popUpMenu("blah", "blah", "blah", "-", ["Names","Steve", "-", "Albert", "-", "Mary", "-", "Juni"] );

                  switch (itemIndex)    {

                   

                  this.getField("DrSteve").fillColor = (resp=="Steve") ? color.ltGray : color.white; 

                  this.getField("DrAlbert").fillColor = (resp=="Albert") ? ["RGB", 135/255, 206/255, 250/255] : color.white; 

                  this.getField("DrMary").fillColor = (resp=="Mary") ? ["RGB", 135/255, 206/255, 250/255] : color.white;    

                        

                          case "":

                          break;

                        

                      case "":

                          break;

                   

                      case "":

                          break;

                  }

                   

                  I tried this and it didn't work.

                  • 6. Re: PopMenu selection to change drop down field's fill color?
                    try67 MVP & Adobe Community Professional

                    Why are you trying to combine the two? Just use the code I provided. It

                    should work on its own.

                    • 7. Re: PopMenu selection to change drop down field's fill color?
                      pdfUser1 Level 1

                      I would, I don't understand it. How to place all the other items and features that are in mine. In mine there's navigational, zoom levels, opens other documents, etc. How would I use yours and still keep the features I have with mine.

                       

                      I would use your script, it's just I don't understand where to place my options. As you can see in my last reply I'm having trouble. Could you provide and example of how to work with yours? I would like to learn what you're referring to.

                      • 8. Re: PopMenu selection to change drop down field's fill color?
                        try67 MVP & Adobe Community Professional

                        The script is not related to any of those other settings. You just apply it as the Mouse Up event of your button (if that's what you want to use), and that's it. Just replace the code you have with the new code and it should work (provided you made the required adjustments, of course).

                        • 9. Re: PopMenu selection to change drop down field's fill color?
                          pdfUser1 Level 1

                          I'm sorry, I'm too much of a novice to understand what you're saying and explaining. I don't have a clue. The only thing I understand is "mouse up".

                           

                          But, thanks for your time. I just don't understand what you're talking about. I could follow by example.