4 Replies Latest reply on Apr 17, 2015 4:56 AM by Mike_Mitchell

    Toolbar Events

    tmslayton

      HI,

       

      I am trying to figure out how to hook into the toolbar events. I was looking at the Content Management sample and when you are in the list view if you click the new record button in the toolbar it navigates to the detail layout and starts a new record.

       

      How does one access that event?

       

      Thanks,

       

      Tom

        • 1. Re: Toolbar Events
          Mike_Mitchell

          Hello, Tom.

           

          The icons in the toolbar are tied to menu commands. In your example, the New Record button is tied to the New Record menu item. You can commandeer these commands using Custom Menus and substitute a script of your choosing instead of the default command.

           

          HTH

           

          Mike

          • 2. Re: Toolbar Events
            tmslayton

            Thank you Mike, I found the debugger in FileMaker and stepped through the code in the sample and found that they are hooking in to the event for creating a new record with the standard menu item. When the new record event fires there is a script that takes them to the newly created record in the detail layout immediately.

             

            Best,

             

            Tom

            • 3. Re: Toolbar Events
              siplus

              You can specify triggers connected not only to a field or object, but also to a layout.

               

              In layout mode select Layout Setup... from the Layouts menu, then go to the "Script Triggers" tab and you will find the trigger you are looking for ( OnRecordLoad)

               

              What happens is:

               

              - The list layout has a script attached to the OnRecordLoad event;

               

              - Creating a new record while being on that layout, either by using "new record" from the Records menu or by using the icon in the toolbar or by using a button created by you, will trigger the OnRecordLoad, because a new record gets "loaded".

              • 4. Re: Toolbar Events
                Mike_Mitchell

                Just to build on siplus's answer:

                 

                There is no "new record" event in FileMaker. You can find a complete list of Script Trigger events here:

                 

                Script triggers reference

                 

                It's worth noting that the OnRecordLoad event will fire every time a record loads, not just a new one. So browsing through records, entering Browse mode with a non-null found set, switching layouts to the layout on which that trigger is set, etc., will all cause that trigger to fire.