4 Replies Latest reply on Jan 8, 2017 6:17 PM by Malcolm

    Change a button but keep the code?


      Hi all,


      I have a form which has approximately 400 buttons on it.  (They are to change the value up or down on a layout).  I've been asked if I can change the colours of the buttons but at present, I have a piece of code applied to each button. (When you press the button it changes the value up or down in a specific field.


      Is there any way I can change the image I use for the button but keep the code attached?  This will be a LONG process otherwise.





        • 1. Re: Change a button but keep the code?

          If you using something like Clip Manager you could copy all of the layout elements, paste into Clip Manager where you can see the XML of the layout, find the parts for the button - theoretically it should be the same code for the button.


          On a new layout, create the new button and do the same thing - copy and paste into Clip Manager, take that XML into a text editor.


          You can take the XML into a text editor and then try a find and replace of the old graphic code, replacing with the new.


          Take the modified XML back to Clip Manager and then it can go back into FileMaker.


          Needless to say - try this on a backup. There is a very good chance it doesn't work the first time and it'd be risky but it could save you manually changing 400 instances.

          • 2. Re: Change a button but keep the code?

            The script attached to the button is not affected by changes to formatting.


            Also, provided you want all the buttons to look the same, you can change them all at once. To do this, first set up one button to look the way that you want. Select the button and go to the formatting tab on the inspector and use the eyedropper copy button to copy all your formatting. Now, select the other 399 ( or batches of ) buttons and use the eyedropper paste button to transfer the formatting.



            • 3. Re: Change a button but keep the code?

              Better still, use the features of Themes and Styles to your advantage. To do so, take one button and set it up as you want it, then define it as a style and then apply that style to all the buttons. This will mean that every one of your buttons will need to be visited in the first instance to be assigned the new style, but from then on if you subsequently changed that style the change would propagate through them all. Alternatively, if they are all currently Default style (which is quite likely) and you want your particular style choice to be the default style, then you can save your changes to the Default style and the change will propagate to everything else that carries that default style already.

              1 of 1 people found this helpful
              • 4. Re: Change a button but keep the code?

                Yes, a much better solution.