LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically change control focus to generate and Event......

Solved!
Go to solution

I'm adding some user enhancement (anti-screw-it-up functions) to insure the desired process is executed.

 

Primary question:  If I have an event that is handles by a value change in a text control, (event happens when you hit Enter or exit control with mouse) will the event also occur if you exit the control by programatically changing the focus to another control ?

 

I'm going to try and set up a temp vi to test this but wanted to see if anyone had tried this and if it works or not.  My other option is to set up multiple event cases but I was hoping to use a single case to handle everything.

 

A few details,  I have a test system that tests a product automatically when the product is placed in a cradle and the cradle is moved into position and activates a prox sensor.  At end of test, system waits for prox sensor to de-activate before resetting the system.

 

If a unit fails, there are rework options and the unit can be retested.  When it fails, a label prints defining the failure modes and provides a failing serial number.  When the unit is retested, the failing serial number is entered into a text control. I want the re-test sequence (queued up in the Event) to occur when either 1, a failing serial number is entered or two a button is pressed (with mouse)  I'm pretty sure pressing a button would in turn automatically create the text control change event so my button can probably be a dummy button just for appearances.

 

Where the hole is if the user enters a failed serial # and doesn't exit the control and then engages a pump to start the test.  I can use a 'Empty Path/String' function but the control will continue to show empty as if nothing was entered until the Enter key is pressed or the mouse is used to exit the control.

 

If I can generate the event by changing the focus, then it will insure that if a failing s/n is entered, the re-test sequence occurs and if nothing exists in that field, it performs a first time test.

 

A little long winded for sure but any thoughts are appreciated.

 

Can't really post any simple code as this feature is in my top level vi and I have a really big app that doesn't warrant uploading.

 

Doug

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 1 of 4
(2,117 Views)
Solution
Accepted by topic author dacad

Yes, changing focus is the same as clicking with a mouse outside the control.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 4
(2,111 Views)

Yup.  My testing seems to concur.

 

Thanks

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 3 of 4
(2,107 Views)

Actually, changing the focus alone did not trigger the event but I was able to then utilize the Empty Path/String function to drive a Value(Signaling) node for the control.

Doug

"My only wish is that I am capable of learning each and every day until my last breath."
0 Kudos
Message 4 of 4
(2,099 Views)