formOPEN and formFRONT

Should either of these triggers be expected to work with TabPanels? At present they do not.

I’m looking for a way to make TabPanels refresh their contents when a form containing them is brought forward, or when the TabPanel itself is chosen and displayed with the parent form.

I can understand why you might think they should, but they don’t.

Tab panels don’t work the way you probably expect that they do. When you switch a panel, Panorama copies all of the objects in the panel form into the current form. Once copied, they are just objects. The form itself is not copied – which means the code and triggers associated with the form aren’t copied either. In other words, the tab panel form does not become part of the main form.

To do what you want, you need to set up code with the formOPEN and formFRONT triggers in your main form. This code will need to check to see which panel is active and execute the proper logic for the situation.

For code that you want to run when you click to make a tab panel active, that code needs to be part of the Tab Panel object. It’s just like any other button.

For example, the tab panel in the Panorama Preferences window has this code in it.

Here’s part of the logic of the switchTab procedure:

The form also has an event procedure that initializes whatever panel happens to be active when the window is brought to the front.

I suppose it’s theoretically possible that this could be set up to happen automatically, but it would be quite tricky – especially when you consider that a single form can contain two or more tab panels. So I’m not planning any changes in how this works.

In the case that inspired me to make this post, the parent form had three TabPanels. One displayed info pulled from another database and didn’t always update if it was open and the source was edited.

As my post indicated, I had been looking for ways to refresh the TabPanel with an implicit trigger. It hadn’t occurred to me to do it through the Form Actions of the parent form.

It works just as you suggested. Thank you.