From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

xcontrol lost focus event

Hi
I have an xcontrol where the user will click on a part of the control and this will show a configuration control. To complete the functionality I need a way to hide the pop-up control if the user clicks away from the xcontrol. It would usually hide on its own change event or the escape key. I cannot find a 'lost focus' event. Does anyone have any ideas as to how I could achieve this behaviour?
thank you.
0 Kudos
Message 1 of 9
(10,138 Views)

In the past I have monitored the "Mouse Leave" event and started a timer. If the timer reaches a certain value, such as 2 seconds, I automatically cause the panel to close. I know this isn't quite what you wanted, but I'm not sure if there is a way to get Focus events?

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 2 of 9
(10,135 Views)

Hi Daddy,

 

you might be interested in supporting that idea!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 9
(10,131 Views)

@GerdW wrote:

Hi Daddy,

 

you might be interested in supporting that idea!?


Done Smiley Happy

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 4 of 9
(10,127 Views)
Yes. That's what we need. Done 2.
Thanks
0 Kudos
Message 5 of 9
(10,119 Views)
thanks for the input everyone. I am going to write a 'reset' method for the xcontrol and call it whenever the user clicks outside of any conl. This will do in the absence of a lost focus event. i hope we get this next year !
Michael
0 Kudos
Message 6 of 9
(10,108 Views)

Hi Everyone,

 

I think I might have found a tricky workaround (maybe it was already found before but didn't find anything related to).

 

Actually it is not a perfect workaround ( i.e detect the event of focus lost) cause it only works when compiling the .vi using the Xcontrol in an executable. It make the trick for my application so I would like to share it with you.

 

When executing as a .vi it doesn't work. See attached code.

 

1°) Launch the UnitTest.vi (LabVIEW 2012). None dialog box appear as a result of lost focus event.

 

2°) launch the executable "UnitTest.exe" in the build folder. Follow the same testing process as describe on the front panel. Now the lost focus event is detected.

 

The main part of the code making it possible is registering a callback in the Init.vi ability of the Xcontrol.

 

 

Romain DUVAL || RF & Semiconductor Staff System Engineer || CLA || CTA
National Instruments France

Message 7 of 9
(10,032 Views)

Hi Romain,

 

any chance to get a down-converted version (LV2011 would be fine for me...)?

Best regards,
GerdW


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

Sure I saved it as 9.0/10.0/11.0.

 

Regards

 

Romain DUVAL || RF & Semiconductor Staff System Engineer || CLA || CTA
National Instruments France

0 Kudos
Message 9 of 9
(9,987 Views)