Swapping out Header Windows

I am using the basic 2 window setup that was presented during a demo we watched. I have a Header window and then a Body window. The Body windows change without issue.

What I would like to do is also Swap out my Header windows. I have a MAIN header and then have broken each of the manufacturing departments out with their own Headers. I cannot seem to figure this out.

I am sure you have a quick and painless solution for this.

thank you

keith bowling

Use the swapWindow function. This comes in 2 versions, depending on where you are running the code from.

Take the example of wanting to replace Header 1 with Header 2.

If you are running the code from a button on Header 1, use the following code on a button:fpmi.nav.swapWindow(event,"Header 2")If you are running the code from a button on another window, use the following code:fpmi.nav.swapWindow("Header 1","Header 2")
Quick and painless!

Al

Thanks, Al - you beat me to it

A few pointers:

  1. If you’re switching back and forth you’ll need to store the window name that you’re swapping (string). I’d use a DB SQLTag for this. Set the variable to the current window name every time you swap. Best yet, write a simple script module function to do this.

  2. If you load the window once, I’d put it in the startup global event script and load based on group membership that the user belongs to (fpmi.security.getroles).

Nathan - a DB SQLTag would be a bad choice for this becase they are shared by all clients. A Client SQLTag would be more appropriate.

Doww - of course…

I may actually be daft here, but I am still missing something. I want to be able to click the mouse on the TAB container to trigger the window switch. It is currently being used to switch the body window. The code is below:

if({[System]Client/User/CurrentWindow}={Root Container.Home.windowName},
1,0)

How would I go about adding the “Header Window Swap” to this code so it would swap both the header and the body?

Thank you,

Keith

I’m a bit confused - I don’t know what you’re using that expression for. The ‘classical’ implementation of the Tab Strip is to put it on a separate docked window and use it to swap the main window (which will be floating and maximised). To do this, you don’t need any code at all - if you right-click on a Tab Strip and select Tab Strip Customizer (Ctrl-U), the default behaviour is to Swap Windows (the window a tab will swap to is entered in the Tab Name field).

If you also want to switch your docked window (what you refer to as your header), you will have to put something like the following code in the Tab Strip propertyChange event on the first header window:if event.propertyName == 'selectedTab': if event.source.selectedTab == 'Main 2': fpmi.nav.swapWindow("Header 1","Header 2")and in the second header window:if event.propertyName == 'selectedTab': if event.source.selectedTab == 'Main 1': fpmi.nav.swapWindow("Header 2","Header 1")
You will also have to put code in the internalFrameActivated event of each header window to ensure the correct tab is selected - during testing I found the tabs didn’t update properly. For Header 1 this would look like this:fpmi.gui.getParentWindow(event).getComponentForPath('Root Container.Tab Strip').selectedTab = "Main 1"
Doing it this way you won’t have to use any DB Tags, as you’ll always know where you’re coming from and where you’re going (!)

Hopefully this helps and doesn’t confuse you further.

Al

WOW! You lost me with the first sentence. I copied the Header/docked window directly from the demo we viewed months ago. This is the first time I have heard the term “Tab Strip.” I do not get the Tab Strip Customizer when I right click on the tabs.

I also could not try the codes you posted because I cannot find anything with “Tab Strip propertyChange.”

Not sure what is next.

It may help to know that I am working with Version 3.2.5. and a great deal of my project was written very long ago before some of these very neat bells and whistles existed.

Well, we’ve both managed to confuse each other :slight_smile: What do you mean by ‘the TAB container’? It might be best if you uploaded the pictures you want to swap between e.g. a couple of main pictures and the headers, then describe how you want them to work. You can delete any stuff you don’t want others to see off the pictures.

Do you have any reason not to update to the latest version?

Al

Because we have used the software for so long, sometimes the updates cause items do stop functioning correctly. I am cautious when I upgrade and have a duplicate system running to test it out on. I just have not had the time to try this new version.

I am using old code that creates a container within the root container for the header. This is for the tabs. The container houses 2 different images for the tab and the code to switch between the 2 images as well as swapping out the windows.

I will download the upgrade and install it on my dup system and see if it cause any problems. It sounds like they have coded a nifty little tab module that works so much easier. That has been my history. I learn it the hard way and then they make it easier.

Thank you for the help.

Keith