8 Replies Latest reply on Jan 9, 2015 6:23 AM by philmodjunk

    Different Pictures for each tab

    FilipePimentel

      Title

      Different Pictures for each tab

      Post

      Hello there, 

      I have field type container and I would like it to show a logo based on the tab it is showing. As you can see in the image, I have the picture container and below a 2-tab Tab Control. 

      One tab is for a English School (Achieve) and the other is for a IT School (Venko). I want the picture contain to show the logo for the English School when that tab is active. 

      Is that at all possible? 

      Thanks for any lights shed on this...

      F

      Tab_and_image.png

        • 1. Re: Different Pictures for each tab
          philmodjunk

          Option A (Must have FileMaker 13 or newer)

          Set up two container fields. Put one image in one field and the other into the other. Give at least the top field an object name in the inspector. Put the two fields on top of each other. Use the OnPanelSwitch Script trigger on the tab control to run a script that determines the current front tab panel and updates a global variable followed by a refresh object script step to refresh the uppermost container field.

          Specify a "hide object when" expression in the Inspector's Data tab that hides the upper container field when the value of the global variable indicates that the other container field should be visible.

          Option B (works with older versions as well as FMP 13)

          Set up a table with a container field and two records, one for each image. Set up a relationship from the layout's table to this added table with a relationship such as:

          LayoutTable::SelectedLogo = Logos::__pkLogoID

          Use the same ONPanelSwitch trigger (but the name is different in 12 ) or the OnObjectModiry (versions older than 12) trigger to run your script, but now set SelectedLogo to the ID of the desired image. If using a version older than 12, you'll need to give the two tab panels object names and use GetLayoutObjectAttribute to determine which value is the front tab panel.

          • 2. Re: Different Pictures for each tab
            FilipePimentel

            Hello there, 

            Thanks for the reply. 

            But I am looking for a script that would fit the bill, but cannot find how to write one (I am not big on scripts as yet...). 

            Would i bed right, if I was following part of this instructions? 

            http://forums.filemaker.com/posts/e21694401c

            Thanks once again

            VenkoDesigns

            • 3. Re: Different Pictures for each tab
              philmodjunk

              That could be part of the solution if you are using FIleMaker 11 or older. There are simpler methods possible with 12 and 13.

              What version of FIleMaker are you using?

              Which of the two options do you want to implement?

              • 4. Re: Different Pictures for each tab
                FilipePimentel

                Hello there, 

                I am using Filemaker 13 Adv Pro. 

                Of your two option, I believe the first one is more appropriated as seems more up-to-date and in line with the advancementes of FileMaker 13.  

                • 5. Re: Different Pictures for each tab
                  philmodjunk

                  Not really. It just employs a different method that works in both old and new versions.

                  Let's put the container field with the "achieve logo" inserted into it on top of the second container field with the Venko logo. Give the top container field an object name of "Achieve". (You can, of course use your own choices for these names.)

                  Set up the OnPanelSwitch Script trigger for your tab control to perform the following script:

                  If [ GetValue ( Get ( TriggerTargetPanel ) ; 1 ) = 1 // Achieve panel is up ]
                     Set Variable [$$ContainerVisible ; value: "Achieve" ]
                  Else
                     Set Variable [$$ContainerVisible ; value: "Achieve" ]
                  End IF
                  Refresh Object ["Achieve" ]

                  On your layout, set the "Hide object When" expression for the Achieve container field to be:

                  $$ContainerVisible ≠ "Achieve"

                  • 6. Re: Different Pictures for each tab
                    FilipePimentel

                    Good Morning Phil....

                    It worked. Just a comment. On the line "Set Variable", after the Else...the Value should be Venko, correct?

                    Regards, 

                     

                     

                    • 7. Re: Different Pictures for each tab
                      FilipePimentel

                      Hello Phil, 

                      Just another question: If my Tab control had more than 2 tab, say 4...

                      On my script I would have nested if's being the value of the  - If [ GetValue ( Get ( TriggerTargetPanel ) ; 1 ) = 1, then 

                      If [ GetValue ( Get ( TriggerTargetPanel ) ; 2 ) = 2, and so on, correct? 

                      Once again, 

                      Thanks

                      VenkoDesigns

                      • 8. Re: Different Pictures for each tab
                        philmodjunk

                        You are correct on the Set Variable and you would need to set up a chain of IF, Else IF steps in your script.