Hi guys, I’m currently editing a property change for one of my buttons. I’d like its visibility to be defined by a component of another page.
So this button is on a docked “footer” page, that’s always open and opened at start up. and the component is a tab strip, that’s located in a docked “header” which is also always open & on start up.
I was adviced to use vision client tags for this indirection…however looking into it, im not sure on how i can utilise this feature with a client tag. ?
Thank you
To start with create a boolean vision client tag, name it something that makes sense for what it is being used for.
And then bind the boolean vision tag you created to the ‘visibility’ property of the button on the footer
I’m assuming you want the button to be present if a specific tab is selected in the tab strip on the header. In that case:
Place this in the propertyChanged event handler for the tab strip:
if event.propertyName == "selectedTab":
tab = event.source.selectedTab
if tab == "Tab name": #Use the tab name that is going to make the footer button visible
system.tag.writeBlocking(["Path_To_Vision_Client_Tag"],[1])
else:
system.tag.writeBlocking(["Path_To_Vision_Client_Tag"],[0])
The other option if you don’t want to use system.tag.writeBlocking is to create a custom property for the tab strip. Make a boolean custom property and bind it to the same vision client tag. This is arguably cleaner.
Then place this in the propertyChanged event handler for the tab strip:
if event.propertyName == "selectedTab":
tab = event.source.selectedTab
if tab == "Tab name": #Use the tab name that is going to make the footer button visible
event.source.customProperty = 1 #customProperty should be replaced with whatever you named your custom property
else:
event.source.customProperty = 0
That should make the button appear when the tab is selected and disappear if the tab is not selected
1 Like
Thank you so much! this 100% helped.
I used your first suggestion, and from this i changed the tag into a string and wrote a the tab name to the client tag, dependant on which tab is selected. to then the visibility of multiple “help” buttons relied on which tab was selected.
if event.propertyName == "selectedTab":
tab = event.source.selectedTab
if tab == "test1": #Use the tab name that is going to make the footer button visible
system.tag.writeBlocking(['[client]Header_Tab.Value'],["test1"])
elif tab == "test2":
system.tag.writeBlocking(['[client]Header_Tab.Value'],["test2"])
elif tab == "test3":
system.tag.writeBlocking(['[client]Header_Tab.Value'],["test3"])
else:
system.tag.writeBlocking(['[client]Header_MainTabStrip.Value'],["0"])
{[client]Header_Tab.Value}="test1"
{[client]Header_MainTabStrip.Value}="test2"
{[client]Header_MainTabStrip.Value}="test3"
and the button will have this expression in visibility:
{[client]Header_Tab.Value}="test1"
And it works great thank you for your help!
Can i just ask, when I click on my last tab (test3) the button appears, but when i switch to a different tab and switch to test 3 again, the button doesnt reappear again …i dont get any error messages but there should be some logged error, right?
I’m not entirely sure, that sounds a bit strange that it would appear on first time selecting but not on reselecting. Sounds like something may be overwriting the value in the tag.
Also In the code you supplied you are using two different tag names? I don’t know if that’s a typo or intentional.
sorry that is definitely a typo in the code I’ve pasted.
I’ve have a scan through to what else is being written onto it. thank you ryan!