Showing results for 
Search instead for 
Did you mean: 

activate floating window

Go to solution

I have a dialog that I want to make floating, so it stays on top of other windows, while allowing interaction with other windows. However, my dialog can also receive some keyboard shortcuts, and I can't seem to make the window both floating and active. I have to click on the window before it becomes active and can accept keyboard shortcuts, which kindof defeats the purpose of the shortcuts.


I've tried using the FP Open/activate property, but it seems to have no effect on actually "activating" the window. Does anyone know the trick?

Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 1 of 17

I also tried setting the Is Frontmost property of the window, and this did not solve the problem.

Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 2 of 17

What do you mean by "while allowing interaction with other windows"?  Normally, one Window has the focus and receives the keystrokes -- in the case of a Dialog Window, it stays on top of other Windows and insists on the Focus until dismissed.  If that is the behavior you want, make this a sub-VI and set its Window property to Dialog.


Bob Schor

0 Kudos
Message 3 of 17

Yes, Bob, a dialog is usually Modal, and you have described what modal means: window has focus and doesn't allow change of focus. However, this is not what I'm after. I'm using the other of the three window-behaviour options: Floating. This means the window is always on top, but does not retain sole focus, so you can interact with other LabVIEW windows. The question is how to prgramatically cause the floating window to have focus so it can recieve keystrokes.


Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 4 of 17

You need to step back and rethink what you're asking.


The purpose of floating is so that it's always on top but doesn't retain focus.

You want it always on top while retaining focus.


Do you see the disconnect? 


From what little you've told us, it sounds like the entire purpose of this floating window is to accept key strokes.  Why not add that functionality to your main VI and skip this whole process of popping open a window? 

0 Kudos
Message 5 of 17

I think what I'm asking is perfectly clear, correct, and logical. There is no disconnect. If you actually have tried htis you'd know that a floating window can *relinquish* focus, but it can also HAVE focus. It opens by default without focus, ut attains focus when clicked on. Focus on, focus off. The trouble is, and here's my question: how does one programatically put focus on a floating window?


As I mentioned, I can give it focus by clicking on the window. I hve not found a way to give it focus programatically. This is what I want to do. The functionality I described is exactly what I want. And this is really the only question here. The answer may very well be this is not possible, in which case I would consider this a flaw, if not a bug, in LabVIEW.

Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 6 of 17

What you asked for was confusing, poorly communicated, and the furthest thing from clear.  But, now that you've seen several different people all miss your intent, we appreciate you taking the time to ACTUALLY explain what you're looking for. 


You're looking to do something that you're going to best be served by using .NET constructors to change the focus. has an example of using .NET for this exact purpose.


Call it a bug, or flaw, all you'd like.

0 Kudos
Message 7 of 17
I think I see what you are trying to do. One way of accomplishing it would be to let the main window catch the keystrokes and use UDEs to pass the signalling on to the floating window.


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 17

You would be best served biting your tongue when asking people for help.  Here are several options (I don't have LabVIEW at home, so cannot confirm these work properly at this time):


Using a LabVIEW property:


Using the WinAPI.  It takes two steps.  You have to get the window handle: and then you can set the active window:  This method I know works, because I have LabVIEW code written for these API calls.


The reason your method doesn't work is that the Activate input only applies when the window is opened for the first time.


Now that you have your answers, I will also say that what you are doing is poor design.  You will have to constantly sit there and reactivate the window., since your user may be clicking away to another window at any time.

0 Kudos
Message 9 of 17

HI Matthew, Thank you for your help. As I mentioned, the frontmost property does not work in this case, for floating windows. Hence the problem I'm facing.


Interestingly, the activate input does not work for a floating window when using the FP.Open method, even if set on the first call. (LV2014) This is why i have been calling this a bug, but I don't know if I understand the intention of the floating window. Although you can activate it by clicking on it, perhaps it was conceived as a window that would not usually be activated, so it can't be done programatically. 


I was going to attempt the Win API next, and that's hopeful

Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 10 of 17