Tab control box

Is it possible to create a “box”, like a container or something, that uses tab strip navigation between other boxes? But the main window can’t change, it just stays there behind that box. Like another “layer” of a smaller window inside of the main window, that can be navigated through tab strip.

Like this:

Thanks in advance!

Ignition’s tab-strip control component has two modes of operation. By default, it does window swapping as each tab is selected. That can be turned off, and the user can then use the selected tab to control visibility of containers on the same window. Each container would have the same size and position – aligned to edge of the tab-strip, but the visibility binding will let you see only one at a time.

1 Like

Alright! How the visibility should be binded? Could you give me a little push? I tried to script this yesterday, using the containers, but I was getting an error message and couldn’t get rid of it. I don’t know what was wrong on my script, but now it’s already erased, so I can’t show you.

Thanks

So, I generally give the container a meaningful name, and put that as the “window name” in the tab-strip. Then the container’s visibility binding would look like this (expression binding):

{Root Container.Tab1.name}={Root Container.Tab Strip.selectedTab}

Note that you’ll be flipping into preview mode often to switch which tab you want to work on.

1 Like

Here is a simple example. There are two containers on top of eachother, and a tab strip above them. As @pturmel suggested, the visibility is changed on each, depending on the name of the selected tab in the tab strip.

Tab flipping_2018-04-05_1105.proj (6.8 KB)

As a side note, you can re-position containers by holding down the alt key while dragging.

1 Like

Unfortunately, I can’t open that .proj you sent. :frowning2:
The version of Ignition i’m using is 7.7.7. When I try to open your file, it says it can’t open projects from newer versions of Ignition :((((((((( sad

But I made it work with @pturmel answer. Thanks to both of you!

I’m using 7.9.4 I think.

Well… There are two containers. Yellow and Red, with the visibility property using an expression: if({Root Container.Yellow.name} = {Root Container.Tab Strip.selectedTab},1,0) and if({Root Container.Red.name} = {Root Container.Tab Strip.selectedTab},1,0). The tab strip has two tabs, with the “Window Name” set to “Red” and “Yellow” (the names of the containers".

The ‘if’ function is unnecessary. Equality comparisons yield booleans, which are perfectly fine for boolean property bindings.

1 Like

@pturmel You’re correct; however, I usually choose to leave the if so that it is more apparent what is happening. Easier for less experienced programmers to decipher!

Similarly, I will usually write:

if ( boolean_variable == true ){
   // Do something
}

Rather than:

if ( boolean_variable ){
   // Do something
}

There are times (and this may be one of them) that including the if actually makes the binding more confusing, in which case, it should be removed.

1 Like

Having to put in a superfluous comparison generally means one’s variable names suck. If you follow reasonable guidelines (I like this summary), that problem goes away.