4 Replies Latest reply on Mar 28, 2013 10:35 AM by disabled_JustinClose

    Reformatting text in a drop-down?


      Reformatting text in a drop-down?


           I was trying to be nice to the user and do some default text setting in a few drop downs on a layout (done when they first navigated to the layout).  I set the text value as well as the color (to a light gray) with the script step: "Set Field [Globals::Picker  ;  value:TextColor ("<enter name>" ; RGB ( 180; 180; 180 ) ) ] "

           But I haven't been able to figure out how to change the text color back to black once a user has picked a value.  I tried a few other script triggers OnModify and used a simialr "TextColor" commands, tried 'RemoveTextColor", tried "RemoveFormatting"...nothing seemed to work.  The default setting for the text color (as shown in the Inspector) is black.

           Any suggestions on how to do this?



        • 1. Re: Reformatting text in a drop-down?

               Set Field [Globals::Picker  ;  value:TextColor (Globals::Picker ; RGB ( 0 ; 0 ; 0 ) ) ]
               Set Field [Globals::Picker  ;  value:TextColorRemove (Globals::Picker ) ]
               Set Field [Globals::Picker  ;  value:TextFormatRemove (Globals::Picker  ) ]

               Will all remove the color, though TextFormatRemove strips out all formatting so that may be a bit drastic here. Any formatting specified in the Inspector for this field will remain in effect.

          • 2. Re: Reformatting text in a drop-down?

                 I thought I had tried similar things, but will give them another shot.  I don't know if I have tried all three in succession.  :)

            • 3. Re: Reformatting text in a drop-down?

                   Any one of them should work. Make sure that you don't get any extra [] in your set field step. If you do, you haven't set up the script step correctly.

                   When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

              • 4. Re: Reformatting text in a drop-down?

                     Doh!  My bad.  I had originally used "Set Field By Name" in an attempt to make the script more flexible.  I had failed to include the table name when specifying the field name, so that step was failing, thus the text wasn't being set. 

                     Works now.  Thanks for the pointers.