LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean - Key Focus

When I right click on string control the key focus property of the control returns True.

 

why when I right click on button control the key focus stays the same?

0 Kudos
Message 1 of 5
(249 Views)

Hi Max,

 

mind to share an example VI?


@maxnoder1995 wrote:

When I right click on string control the key focus property of the control returns True.

why when I right click on button control the key focus stays the same?


Whatever I do no control (neither string, numeric or boolean) gets key focus on right-click in my VI:

Best regards,
GerdW


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

Sorry… I meant left click.

 

I can know if the string value as changed from the user or my program by the key focus.

 

i can’t know if the button as toggled by my program or by the user.

0 Kudos
Message 3 of 5
(239 Views)

Hi Max,

 


@maxnoder1995 wrote:

Sorry… I meant left click.

i can’t know if the button as toggled by my program or by the user.


Ok, left-click only sets keyfocus for string and numeric, but not for boolean…

But you still can detect the "keyfocus" by handling the ValueChange event for your button! (The same applies for string and numeric…)

 


@maxnoder1995 wrote:

I can know if the string value as changed from the user or my program by the key focus.


No, you cannot know the string has really changed just from the keyfocus property!

(But there is a ValueChange event…)

 

Why do you want to rely on KeyFocus property instead of ValueChange events?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(214 Views)

@GerdW wrote:

 


@maxnoder1995 wrote:

I can know if the string value as changed from the user or my program by the key focus.


No, you cannot know the string has really changed just from the keyfocus property!

(But there is a ValueChange event…)

 

Why do you want to rely on KeyFocus property instead of ValueChange events?


In a related note, strings also have two optional setting that often helps

 

  • Update value while typing: Any key is immediately read by the code (By default, the current value is not handed to the code until the entry is terminated)
  • Limit to single line: Allows completing the entry with the enter key (without that setting, you would just go to the second line)

 

I have the nagging feeling that the OP is on a snipe hunt trying to solve a problem that does not really exist. We can give much more specific suggestions once we see the code and a detailed description of the re

 

0 Kudos
Message 5 of 5
(170 Views)