LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Control Display Format while user is entering data

Solved!
Go to solution

Hi all,

I have a control with display format %#0fmL

My goal is to hide the mL when the user is entering data.

I noticed that controls seem to automatically convert any known SI Unit within the control itself, meaning 80m gets converted to .08
I was told we do not want to use the built-in SI unit label for the control for aesthetic reasons. For my case the SI unit label is only for visuals.

Because the conversion happens on the control level, I am having trouble manipulating it afterwards.

As a solution, I decided to restrict the accepted keys to numbers, arrows, enter, del, return.
Then add some cases to catch common cases.


The problem I have is that when a user:
1) Mouse down on control
2) Changes the value of control (Does not hit enter AND mouse stays within control)
3) Mouse down on control (without ever leaving control)

The value gets reverted back to the original value.
Is there a way to manipulate this so that I can keep the new, but not entered value?
If there is an easier solution, please let me know as I am relatively new to LabVIEW.
Thank you in advance!

 

0 Kudos
Message 1 of 9
(234 Views)

Hi Jeff,

 

why don't you place a simple text constant of "ml" next to the numeric input to "fake" the unit?

The control itself should use the format "%#0f"…

 

Like this:

This way you could even set the control to an integer datatype when you don't care about fractions…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(215 Views)

Thank you GerdW,
My supervisor had told me that for aesthetic reasons, we didn't want to utilize this built-in label.

I've been looking for a work around but am struggling.

Thanks again! 

0 Kudos
Message 3 of 9
(209 Views)
Solution
Accepted by topic author jyoo221

This seems to work, although not so smart...

test.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 4 of 9
(182 Views)

Hi Jeff,

 


@jyoo221 wrote:

My supervisor had told me that for aesthetic reasons, we didn't want to utilize this built-in label.

I've been looking for a work around but am struggling.


And I wrote to use a simple text constant instead…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 9
(153 Views)
Solution
Accepted by topic author jyoo221

Thanks for the input pincpanter...fantastic name.
That clever little check on KeyFocus does seem to do the trick.
As you stated "not so smart"...I am assuming you mention this because of the constant checking that will eat up memory.

I am hoping I can work with my supervisor to see if we can find a logical time to run this and make it more manageable.

Thank you for the insight! This is what I was looking for.

0 Kudos
Message 6 of 9
(149 Views)

Thank you GerdW,
I missed that initial part, sorry about that.
But this is part of a larger project that which these controls are already being implemented and used.
I am doing what I can to keep the original data types/architecture. But yes, I agree, making the control a string would have been the ideal play if I was allowed!!

Thanks again

0 Kudos
Message 7 of 9
(145 Views)

Hi Jeff,

 


@jyoo221 wrote:

But yes, I agree, making the control a string would have been the ideal


I never wrote to "make the control a string"!

 

To put my recommendation in other words: remove the "ml" from your format string. Double-click the frontpanel to create a free text label and type "ml" into this label. Place this free label next to your numeric control to fake the unit…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(103 Views)

The problem I have is that when a user:
1) Mouse down on control
2) Changes the value of control (Does not hit enter AND mouse stays within control)
3) Mouse down on control (without ever leaving control)


I followed these steps and I don't see the reversion to the old value. If I enter a value and then click the control again, nothing happens. What is the issue, exactly?

 

I don't see why you need to hide the units while a value is being entered. If double click the value (selects all in the control), and then enter a value, and hit enter and the units are correctly applied. Or, you can place a cursor and type (if you place the cursor in the units, the typed value is not accepted. Anyway, the niceties you are trying to achieve may be a waste of time. Go collect useful data instead?

 

Anyway, I really like the units in the display with SI notation, because you can enter SI notation and it all gets converted properly. For example, with %#_6pL if your units are L and you type "6m", it will display 6mL. Neat!

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 9 of 9
(81 Views)