From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

change font default text color to toggle boolean text

Solved!
Go to solution

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?

Duri_0-1601961572206.png

Duri_1-1601961607106.png

Change in Options >> Environment, does not seem to work.

 

Thanks

 

Duri
0 Kudos
Message 1 of 6
(1,319 Views)

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.

0 Kudos
Message 2 of 6
(1,287 Views)
I am not sure what you mean with callback event.

I've seen ActiveX and .NET callbacks but not for simple control. Could you explain more?
Duri
0 Kudos
Message 3 of 6
(1,265 Views)
Solution
Accepted by topic author Duri

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...

Message 4 of 6
(1,258 Views)

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.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 5 of 6
(1,242 Views)

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.

Duri
0 Kudos
Message 6 of 6
(997 Views)