10-06-2020 12:21 AM
Hi All,
there is nice feature in LabVIEW, to toggle button text from black to white and vice versa when button is pressed, depressed.
Unfortunately it works only when font color is black (text).
Is there a way to change default text color to some other color in order to let LabVIEW do the toggle and not do it programmatically?
Change in Options >> Environment, does not seem to work.
Thanks
Solved! Go to Solution.
10-06-2020 02:48 AM
I don't think so.
But if you do it programmatically, you can probably use a callback event. This would require only one VI to be added to your diagrams. This would reduce clutter in your main event structure\diagram. It also makes for a nice self contained and reusable peace of functionality.
10-06-2020 04:27 AM
10-06-2020 05:01 AM
You can wire a LabVIEW reference to the .NET\AX callback function. That's it!
The benefit is that the callback VI is started when the function is called, and automatically stops when the caller stops.
You'd want to avoid putting the button handling in your main code, because it will a) clutter your main functionality and b) produce code that is not reusable. Callback VIs can be started in one VI, and from that run on their own. This VI is easy to reuse, simply put the VI on your diagram and wire the reference(s).
Alternatively, you can start a dynamic VI, but it's a bit harder to manage the lifetime of this VI.
A third alternative would be to make an XControl...
10-06-2020 01:23 PM
It's not just black and white. When the text color is the same as the button color, LV will switch the text color to either black or white. As far as I know, there's no way to change that.
08-25-2021 04:45 AM
Thanks for idea.
I saw callbacks and was like, no, I do not have time for that right now. Then completely forgot about I asked something on the forum.
Got to it today and was amazed how easy to implement it is for my case. Example is attached for anyone searching for something similar.
Now I wish I spent more time looking into this topic. Need to refactor.