Putting One Object Into Multiple Tabs

By Daniel Wood, 15 December 2010

Here is a nice quick technique that will allow you to place a layout object or objects into more than one tab on any given tab control object.

The Problem

With tab control objects, when you place an object inside a tab, then that object is now enclosed within that tab. Switching to a different tab will effectively hide the object, because being on the other tab it is no longer visible.

The Reason

Sometimes however, you may have a layout object or objects which you wish to remain consistent across multiple tabs. It could be a portal, web viewer, text label, or series of fields.

The first solution that might come to mind would be to make copies of the layout object(s) and place them into each individual tab control object, there are some downsides to this method:

  • Having copies means any change you need to make to one object, you must repeat changes to all.
  • Being unique layout objects, if you are naming objects for various purposes (ie scripting navigation), then each object requires it's own name, adding some complexity to navigation to the object.
  • In the case of portals, being different objects means each will have their own scroll bar position, switching tabs may yield a different set of visible records in the portal if the scroll positions are different.
  • Web viewers will load when first viewed, so when changing tabs you will have each web viewer loading itself, rather than loading once for all tabs.
  • and so on....

The Solution

The solution to this issue lies in the rules surrounding when a layout object is considered "in" a tab control object, and when it is not. Basically, a layout object is considered outside of a tab if it's top coordinate lies outside of the tab.

Note that a tab actually encompasses part of it's tab label area as well as the inner tab section (see photo).

objmultipletabs 1

So, the goal is to somehow get the top coordinate of the layout object(s) positioned so that it lies outside of the tab control object

The Method

To do this, first start with the layout object you wish to place in each tab control, positioned outside of the tab object iself. In this example, I will be using a green circle object.

objmultipletabs 2

Next, create another layout object and place this directly above the other object, place it so that it lies above the tab control object.

objmultipletabs 3

For the sake of this example I have made the second object a green square. Note that this second object should be a very simple INVISIBLE object - a text label which is just a space, or a transparent no-line rectange, or even a 0pt line would all be acceptable.

Next, you want to select both objects and group them using the group command - Arrange -> Group.

objmultipletabs 4

The reason why this is all done outside of the tab control object is that FileMaker will not allow you to group objects that are both inside and outside of a tab control object, it's either all in or all out.

However, once grouped, you can place half the grouped object in the tab control, and half out, and this is what we will be doing.

objmultipletabs 5

With the grouped object placed in the correct position, it now appears as if the circle is in the first tab. Changing tabs will show the circle apparently in every tab. In actuality, the layout object - which is now the grouped object - is outside of all tab control objects. The rule in FileMaker is that if a layout object is both in and out of a tab control object, it will appear in front of any other object within the tab. The circle is basically in front of the tab control object in terms of layout ordering, and so appears in front of every tab.

Final Thoughts:
This technique is great, and I use it all the time. You can use the same idea to produce fields/labels that appear beside tab names - rather than have to put the fields into every tab, group them with a single object above the tab control to keep them visible no matter what tab you have selected.

Cheers.

Something to say? Post a comment...

Comments

  • Daniel Wood 01/01/2013 10:18am (11 years ago)

    Hi Rob, you are right that tab control behavior has changed somewhat in FileMaker 12. This article was written pre-12 so applies to 11 and earlier. For 12, you can position an object such that it looks like it is in the tab but in actual fact it is in front of the tab object and all the tabs. You normally have to drag it with the mouse or use inspector to give it top/left coordinates to put it there, because as soon as you move it with the arrow keys it will "snap" into the tab control that underlies it and be contained within that tab. There is another more recent article about things to do with tab controls in 12 which might talk about this.

  • Rob lewis 01/01/2013 9:59am (11 years ago)

    isn't there another way to do this in FM12 ? Just put what you want directly on the layout OR in another tab panel all MOVE TO THE BACK. Then put a Tab panel directly on top of it. Any tab you assign as being transparent will show its fields along with all what you MOVE TO THE BACK!! Forget the grouping!!!

  • panos 15/07/2011 6:49pm (13 years ago)

    Great tip, I sometimes use it myself. Needs to be reminded though that caution must be exercised if during development objects are ungrouped to performed any modification to either of them. Grouping must be restore, otherwise the inside-the-tab-panel object will appear only in one tab.

  • Jack Rodgers 05/01/2011 12:01pm (13 years ago)

    Nice Catch!

    How many times have we had the errant field showing up in all tabs yet failed to make this connection...

  • David Zakary 02/01/2011 9:01am (13 years ago)

    Neat trick. Usually I'm trying to do the opposite - make sure everything is inside the tab so that it isn't a "global" element. Now I have a reason to use it.

RSS feed for comments on this page | RSS feed for all comments

Categories(show all)

Subscribe

Tags