LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate event when focus lost

Solved!
Go to solution

Hi,

 

is there a way to capture an event when a textbox lose focus?


Thanks.

0 Kudos
Message 1 of 9
(3,980 Views)

You can generate an user event by checking the "Keyfocus" property of the Text box (String control).

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 9
(3,972 Views)

  

Guillaume D
0 Kudos
Message 3 of 9
(3,964 Views)

Hi 1984,

 

you might support this idea

Best regards,
GerdW


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

Just did 🙂

0 Kudos
Message 5 of 9
(3,947 Views)

What is it exactly that you are trying to accomplish? Why do you want to generate an event then?

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 9
(3,911 Views)

Example: User enters a name of an employee to a string control. Once I detect the "value change" event, I make a search in a DB and list some properties associated to the employee. These params can be modified and saved by the user. It is possible though that the user modifies some of the parameters but the decide to return to the original values. In this case he has to enter a different text into the text field and then reenter the name of the employee. Simply entering to the textfield and pressing enter does not trigger the value change event as the value didnt changed so the default values are not loaded back.

 

Now you can ask why dont I simply have a load button. The example above is quite simplified. A load button is not feasible, Detecting a lost focus would resolve my problem though. And I can realize this function but query the focus status of the field in every 10ms, I am just wondering if there is a more elegant way to do it.

0 Kudos
Message 7 of 9
(3,881 Views)
Solution
Accepted by topic author 1984
Yes there is, simply create a key press filter event on that string control and when a tab is entered you fire your (re)load event. Or you could define a custom hot key for that field (like ctrl-D) to set some group of controls to a default state.

What are the complications that would keep a "Load" button from working? Perhaps things are too complicated and you have to simplify things a bit.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 8 of 9
(3,872 Views)

Thanks... for this case checking the keypress works just fine! I was thinking about registering custom event, which I did, but it is an overkill as I can just check for keypress.

0 Kudos
Message 9 of 9
(3,866 Views)