Jump to content

Mouse down filter event - focus

Recommended Posts

Crosspost from here, didn't get momentum there though.


I'm trying to prevent accidental stealing of focus from a string control by discarding the Mouse down? filter event. It turns out however that mouse down on any control or indicator that can take any input, such as strings, numerics, paths etc takes focus away from the string control.


Is there a use case for this that I can't see or is it a bug?


Link to post

I think it is a bug but NI may disagree.  The only other thing I have to add is I wanted to see what control LabVIEW though was in focus and found a private method called "Text Focus" using the front panel reference.  By the way I think this method should be public if NI is listening.


In either case when I went to read the control that has focus it returns a reference with a value of 0 once you enter the Mouse Down? event.  So this means that even before the event structure has a chance to discard the mouse change it will already have lost the focus so by the time LabVIEW discards the mouse down it will be too late.


I also tried disabling the control and it still would steal focus.

FocusLab hooovahh.vi

Link to post

Thanks for that hooovahh.
To make things a bit more puzzling, I thought I had a workaround by setting the key focus back where I wanted it in the 'Mouse down?' event. Works well in my little example, focus stays on my string control if I type and click the indicator at the same time. It doesn't work in my application though, focus is stolen and the typing jumps to the start of the string control. In all honesty I should mention that the actual application is somewhat larger and has three event structures in it, although no other event structure handles any mouse events nor any filter events.
I tried adding a wait before setting focus back at the control thinking that would kill my workaround as in my application, but it turns out that it works even with a lengthy wait in the 'Mouse down?' event.


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By bodopoq
      When using ChirpZ transform of LabVIEW(The example itself provides) to refining the spectrum, I found a strange thing. When the frequency is very big and the range is small together with a not small number of ChirpZ transform, Error happened(very bad spectrum and wrong frequency ChirpZ's result is)! Nothing is wrong with the examples(I've scripted other VIs to verify this), and this error didn't happend using MATLAB. So I believe that is a bug of LabVIEW!!!(Not Sure yet of course). I Need Help!
           Is there any error? Or is there a bug of LabVIEW's ChirpZ tansform?
           I've already uploaded the codes and screenshot.May you have a look.
      Chirp Z Transform Configuration.vi
      Multi Tone Signal Generation.vi
      Spectrum using Chirp Z Transform.vi

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.