8 Replies Latest reply on Aug 16, 2009 3:10 PM by Rramjet

    Script trigger for FMP 10 Tab selection

    Rramjet

      Title

      Script trigger for FMP 10 Tab selection

      Post

      Hi- I cannot get a script trigger to function.

       

      When I click a specified tab, I want to trigger a "find records" script to display only those records related to the fields shown under that tab. 

       

      In Layout Mode I can select the tab (which ostensibly is registered as an object by FMP because I can.. View > Object Info) but when I right-click on the tab/object and then select Set Script Triggers... then select OnObjectEnter and then Select... (MyScript), click OK, return to Browse Mode and finally... click on the tab... the script does not run (Yes, the scipt works perfectly as a stand alone).

       

      I am am running under Windows XP Pro.

       

      Any suggestions?

        • 1. Re: Script trigger for FMP 10 Tab selection
          comment_1
             A script triggered by OnObjectEnter will run only when the object becomes active. A tab control becomes active when you tab into it - not when you switch tab panels.

          If you want the script to run when user switches to another panel, specify OnObjectModify as the triggering event.
          • 2. Re: Script trigger for FMP 10 Tab selection
            Rramjet
              

             

            >>>>>>> Actually, the solution does not work (see my reply message below)<<<<<<<<<<<<<

             

            Yes, that works... thank you :)

             

            This is a particular peculiarity of tab controls?

             

            Thanks again,

            Rramjet.

            • 3. Re: Script trigger for FMP 10 Tab selection
              Rramjet
                

              Oh no... :(

               

              I thought the solution worked, but not really.

               

              FMP does not seem to register that each tab is a separate object, rather that the whole row of tabs is a single object (despite being able to assign separate object properties to each tab control). After assigning a script trigger to one tab control (as suggested above) - it works fine - but then when I go to another tab control and try to trigger a different script, it resets the first tab control (indeed all tab controls in the row) to the new script.

               

              I need each tab control to trigger a different script... not the same one for all.

               

              Any other suggestions?

               

               

              • 4. Re: Script trigger for FMP 10 Tab selection
                comment_1
                  

                You can only attach script triggers to the entire tab control object - not to individual panels. Use the GetLayoutObjectAttribute() function to determine which panel is in front at runtime, and branch accordingly.

                 

                Another option is to use buttons as fake tabs; attach the script to the button and have the script switch the tab control to the corresponding panel, in addition to the required action.

                • 5. Re: Script trigger for FMP 10 Tab selection
                  Rramjet
                    

                  Oooo... But a primary reason I paid a great deal of money ($550 AU) for FMP 10 was because of the tab generation facility. I originally had constructed a dB with "buttons" as stand-ins for tabs but that became too unweildy because (as you probably well know) each tab required the same number of buttons as there were tabs (because each "tab" was in effect a separate layout - and not to mention all the extra scripting) to make it work efficiently - and once I got to 20 plus "tabs" ...well ... let's just say that if anyone wanted to change something (like add a treament modality or merely change the name) I practically felt suicidal...

                   

                  Now you are telling me I must return to the "bad old days"? Granted now each tab (if I go your way) will (should) require only two buttons (differentially shaded for active and non-active - and maybe even that won't work now I think about it...) but it is still "clunky" and time consuming and totally undermines and masks the "elegancy" of FMP10's tab control solution. Oh dear...

                   

                  I know FMP10 is a "first run" attempt at tab control - but as each tab control does already seem to have a separate object identity, surely the developers could find it in their hearts to add the Script Trigger functionality to them individually rather than as a whole? Please...

                   

                  ... and I am not sure how GetLayoutObjectAttribute() will help me here. Am I missing something?

                   

                  Severely dissappointed,

                  Rramjet.

                   

                   

                  • 6. Re: Script trigger for FMP 10 Tab selection
                    comment_1
                      

                    Rramjet wrote:
                    ... and I am not sure how GetLayoutObjectAttribute() will help me here.

                    I'd suggest you read the help regarding the function - esp.regarding the isFrontTabPanel attribute.


                    • 7. Re: Script trigger for FMP 10 Tab selection
                      comment_1
                         You might find this tutorial helpful, too.
                      • 8. Re: Script trigger for FMP 10 Tab selection
                        Rramjet
                          

                        comment wrote:
                        You might find this tutorial helpful, too.

                         

                        Oh indeed, yes I did.

                         

                        The tutorial showed me exactly how to use GetLayoutObjectAttribut() in a "Parent" script to simulate an OnObjectModify script trigger for individual tabs. That is for example:

                         

                         

                        If[GetLayoutObjectAttribute( "MyTab_1"; "isFrontpanel")]

                        Perform Script ["MyScript_1"]

                        Else If [GetLayoutObjectAttribute ( "MyTab_2; "isFrontPanel")]

                        Perform Script ["MyScript_2"]

                        {Else if[]... }

                        End If

                         

                        My faith in FMP has been restored :)

                        (...not that it ever really went away - just that your suggestion of "buttons" to simulate tabs took me to a very dark place!)

                         

                        And thank you for your time and persistance Comment.

                         

                        Regards,

                        Rramjet.