I am in Vision
I created some buttons for navigation and I would like to change the Background Color of the buttons depending on which Window is opened
For example I would like the button “Installation” to be green when the window “MainInstallation” is opened and be white when another window is opened
I tried with property binding expression like in the image but I’m missing the code for “window opened”
You cannot reference other windows in expressions.
You can use scripting functions on client timers and/or window events to keep a boolean client tag updated with this information. You then bind that.
Sorry, not a simple answer.
Thanks for the reply,
I tried with Client Timer Scripts
- I tried to write to a Memory Tag (btnInstallation), it’s a string, doesn’t seem to work
- And I tried to change directly the background, doesn’t work
I guess the code is not correct
But if I can’t do it by Client Timer Scripts, I can follow your recommandation with Window Events to keep my Memory Tag updated, the thing with this solution is I have to do it in every Window I create, instead of having only one Script for all Windows in Client Timer Scripts
I don’t use vision so not a expert in that area. In your query your telling it what to make the background IF the following is true but your not telling it what to make it if its not. So may need a else clause.
How about just writing a int to a client tag then using that to reference the background color. IF tag = 1 make background blue, ELSE if tags is 1<> then background gray on a tag change script.
Refence the same client tag, just change the value appropriately. So next button sets the client tag to 2 and uses IF tag = 2 do this, else if its not 2 then do this.
If you have lots of buttons you may want to use a string instead so you dont have to keep track of which number is already used but using a int might be a basic way to get you started.
Yes, what I did was to create a string tag for each button for the color, so if the window is opened I put the string tag to 00AAFF (blue) and if it is closed to FFFFFF (white)
And the tag is binded to the background color of the button
Thank you for the help
That means when you do your navigation you have to make sure you close your old window. Im no expert but in a big project and may clients would that hurt performance having to load the window every time rather then it being open in the background ?
Well it’s my first time with Ignition
I found this:
It’s for my main windows so it recommends swap
In this case it’s going to be just for 5 pages maybe
I didn’t find any other solution
Use swap for windows that will fill the client (except for any docks). That keeps everything compatible with navigation schemes that use the “currentWindow” operations. For speed, set important windows’ cache policy to “Always”. That will make them re-open practically instantly (at the cost of some extra RAM usage).