I am not sure if there is a chance to assign a null value to the selected Tab of a tab strip, because I want to use the tab Strip as an easy solution. But the problem is that if for any reason I have to click on a button that is not attached to the tab strip for instance 'alarms' and the window changes to alarms windows, the tab strip still selecting the selected Tab in its container. So, this is because the selected Tad property is like a latching value and this is visually annoying. If there is not a way to change this, I would probably have to use one button per window and grouping all of these as a tab strip and that is more time.
I want to make sure I understand your problem correctly:
Your using the tab strip as a docked window, and the alarm button in the docked window is causing the docked window to display the alarms page, while the other window is still displaying the main window that the tab strip opened. Is that correct?
It sounds like the alarm button needs to be reconfigured to open the alarm window in a different way. Perhaps it would look better to close the docked window, and open the alarm window by itself, or perhaps the alarm window should be changed to a popup.
Thanks for your reply,
Well, the button to call the alarm window is configured correctly and it is in a north docked window. For a particular reason I want this button far from the normal navigation docked window.
So, the tab strip is in south docked window and it contains the normal navigation names, such as overview, trends, users' management, states, and few more things. The fact is that when I choose the alarm button, this one has a script that swap to a main window to see an alarm table, but in the 'tab strip' still seeing selected the overview window. So, I don't know if it is possible to create a script in the tab strip that make all the windows unselected when I select a window that is not part of the tab strip. In fact, I tried but nothing happens.
The property is called selectedTab
, and it can be set to None
, so the script you are looking for will look something like this:
# Get the window that contains the tab strip
# Correct this window name
tabWindow = system.gui.getWindow('TabStripWindowName')
# Retrieve the tab strip component from the window
# Correct this component path if needed
tabStrip = tabWindow.rootContainer.getComponent('Tab Strip')
# Deselect all tabs by setting the selected tab to null
tabStrip.selectedTab = None
It should probably be called from the alarm button when it changes the main window
Great dear Justin. That's it the solution. Thank you so much. I was using the wrong syntax, for instance my script was similar but at the end I was using 'null' or 'NULL' instead of 'None'. Hehe. And regarding in what moment to call it, you are right it is better to call it with the alarm button.
it seems it didn't work.
Let me show you the error:
Traceback (most recent call last):
File "event:actionPerformed", line 7, in
java.lang.NullPointerException
java.lang.NullPointerException: java.lang.NullPointerException
caused by NullPointerException
This is the current script I use:
tabWindow = system.gui.getWindow('Navigation')
tabStrip = tabWindow.rootContainer.getComponent('Tab Strip')
tabStrip.selectedTab = None
window = system.nav.openWindow('Alarms')
system.nav.centerWindow(window)
Any idea, let me know.
Regards,
Change your script to this, and look at the console output.
tabWindow = system.gui.getWindow('Navigation')
tabStrip = tabWindow.rootContainer.getComponent('Tab Strip')
print tabWindow
print tabStrip
See which one is null, and then troubleshoot the path
This post I read today seems relevant to what you are wanting to do:
Thanks for your reply. I have just noticed that it is hard to find the right syntax to make this tab strip works well when I don't want a selected tab for any reason. Anyway, working with a SCADA and now trying to use the Tree view as another option, I have found out that a similar thing happens, but then I tried this code in the expression binding of the selected path of my tree view and the results were great:
lookup({Root Container.trvNavigation.data}, {[System]Client/User/CurrentWindow},
"", "windowPath", "path")
+ "/" +
lookup({Root Container.trvNavigation.data}, {[System]Client/User/CurrentWindow},
"", "windowPath", "text")
So, as I have researched the lookup expression function have the following parameters:
lookup(dataset,lookupValue,noMatchValue,lookupColumn,resultColumn)
My dataset is the {Root Container.trvNavigation.data}.
I am looking for my {[System]Client/User/CurrentWindow}.
My result " " if there's a nomatch value.
The column where I should look up the lookup value.
The result is taken from this result column if I find the lookup value.
This expression returns a value bind to the selected path and in this way works great.
Best regards,
Thanks for this tip, It was useful. I apologizes if I didn't use it before. I am new at the forum.