3 Replies Latest reply on Aug 4, 2010 8:30 AM by philmodjunk

    Button to display fields

    MarcGalloway

      Title

      Button to display fields

      Post

      Not sure if FM can do this but thought I would ask. I want to be able to have a button or check box that will display additional fields to be populated if selected but if not keep those fields hidden.

        • 1. Re: Button to display fields
          ninja

          In actual function, no.  But in appearance, yes.

          Have the button perform the step "GoToLayout" and build a layout on which the extra fields are shown.

          For a checkbox, you can either make the checkbox a button that performs Setfield on the checkbox field and then GoToLayout, or you can apply an OnModify script trigger to take you to the new layout.

          • 2. Re: Button to display fields
            FentonJones

            There is a trick, known as Visibility, by John Mark Hopkins, which allows you to really hide/show things (fields, objects). It uses a field on the originating side of a self-relationship, to target a stored field (constant usually, with current ID also if fields)* on the other side. If the relationship is not empty, it shows, if not, it is gone (more than hidden, gone). 

            It still requires space on the layout however.

            Search for "visibility" on the [ Resources ] page of:

            http://www.databasepros.com/FMPro

            * Since it is a relationship, you want to include the unique ID of the table in the self-relationship. Otherwise you'd be looking at the fields of the 1st record. If you're using the trick only to show/hide text or graphic objects only, then only a constant is needed.

            • 3. Re: Button to display fields
              philmodjunk

              Another visibility trick is to use a tabcontrol with invisible color/borders. You can assign object names to the tabs and use go to object in a script to select the tab that contains the fields to make them appear.

              For that matter, instead of getting fancy with buttons and relationships, you could just place these fields in the tab of a regular tab control since clicking a button and clicking a tab are very similar user actions.