1 Reply Latest reply on Feb 20, 2012 4:04 PM by philmodjunk

    Hiding / showing of buttons



      Hiding / showing of buttons


      I am new to FM and need some help on what the command (or script) steps are in order to hide a button based on certain conditions.  When the condition is reversed, I will show the button.  I did not see the specifics of it in the doc although i know it must be there.

      Any help would be appreciated.



        • 1. Re: Hiding / showing of buttons

          FileMaker does not provide a "visibility" property for a button that you can change to hide or reveal a layout object so we have to use other means.

          If we use only layout text as our button (such as the red X used as the delete button in many portals), conditional formatting can make it disappear by changing the font size to 500. With a conventional button created with the button tool, you can use conditional formatting to change the button's label text to grey to make it look disabled. But you then need to include an if step in the button's script to keep anything from happening when the button is supposed to be disabled and you can still click the button and see it highlight, it just doesn't do anything when you click it.

          There are two other methods for controlling layout object visibility:

          1) Put the object in the second panel of a two panel tab control with color and border settings set to be invisible by matching the color of the layout background. Give each tab panel it's own object name in the name box on the inspector's position tab.

          Now a script can be performed that uses go to object to change the visibility of yoru layout object. Specify the object name of the empty panel and th object disappears. Specify the object name of the panel where you've placed the layout object and it appears.

          2) Use a portal to a related table with a relationship that matches to a record in the related table only if your "condition" is the condition that indicates that the button should be visible. If there's a record in the portal, your button is visible if there are no related records it disappears.

          With either 1) or 2) no added scripting need be added to the button's script to disable it as it is not accessble to the user when conditions have hidden the button.