LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Highlight and Numeric Control Question

Solved!
Go to solution

Hi all,

 

I have what is hopefully two simple (maybe stupid) questions regarding Boolean controls and numeric controls. Please see attached VI.

 

I’ll start with the Boolean question. If you run the VI, you will notice that the top Boolean control changes to have a blue border to highlight the button as though it’s being automatically focused. You will also notice that if you hover over the Boolean control, it changes to a light shade of blue. I want to know how these two things are done.

 

As far as can tell (I’ve tried every option in there) It’s not the focusing options contained within the properties doing this. If you press the home key on your keyboard it should show what the act of focusing does to the second Boolean. I have tried making the control a type def to see what picture items were contained but these do not appear to be the answer which is what I expected. Could this Boolean be an Xcontrol as I can’t think how else it could have the hidden functionality? I must point out that this Boolean was extracted from the three button dialog function which of course is a fundamental LabVIEW function.

 

The second question is regarding the numeric control. I want it so that if a value lower than 0 is input, it is coerced to zero. This is fine and works perfect from the data entry settings I have set. Now, let’s assume I input a value of 5. I would like to (if possible) make it such that if I select/highlight the entire value with my mouse (so hold down left button and select all) that when I hit the Delete key or backspace key that the value is wiped out and reset/coerced to zero. Is this possible without some clever jiggery pokery with property nodes/event structure etc?

 

Cheers in advance

 

Mitch

0 Kudos
Message 1 of 5
(3,042 Views)

The boolean is a system control (from the system palette) and as such inherits these cosmetics from the OS. It will look different depending on your OS version and windows theme setting. You have very little control over this.

 

You can create a key down event for the control. Have it contain a case structure. Create a case for the delete key and in it write a zero to a local variable of the control. Seems to work as your description requires. (see attached, the zero will appear once the control loses focus).

 

 

0 Kudos
Message 2 of 5
(3,019 Views)

Hi altenbach,

 

I had already seen and tried the system boolean control but this does not exhibit the same behavior as that in my VI (at least not on my machine anyway) Any ideas why?

 

Regarding the numeric control, this is the same idea that I had also had but wanted to know if it was possible to do without any extra code so just with the data entry settings to coerce to zero. I guess not but its not a lot of code to implement the functionality in fairness.

0 Kudos
Message 3 of 5
(3,010 Views)
Solution
Accepted by topic author Mitch_Peplow

Mitch_Peplow wrote:

I had already seen and tried the system boolean control but this does not exhibit the same behavior as that in my VI (at least not on my machine anyway) Any ideas why?


You see the blue outline if the button has keyboard focus. you can press tab to change focus and it will disappear.

 

In your case the buttton is associated with the <return> key, thus it has focus when the VI starts running. You can associate the <return> key to a different boolean button from the system palette and you will see the same behavior.

Message 4 of 5
(3,001 Views)

Perfect, cheers altenbach

0 Kudos
Message 5 of 5
(2,993 Views)