LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Active window property/method?

Is there is property or method that will return whether or not a specific VI is the active (has focus) window?

 

Thanks,

Cristian

0 Kudos
Message 1 of 18
(6,426 Views)
One thing I failed to mention is that the window that I am checking the active state for is set up as a floating window, so the 'FP.IsFrontmost' will not function correctly.
0 Kudos
Message 2 of 18
(6,417 Views)
What doesn't function correctly? I just tried it and it seems to work just fine. If the floating window is active then the property is true. Otherwise it's false.
0 Kudos
Message 3 of 18
(6,387 Views)

hmm...I created a simple example to test this and the boolean stays false even if the front panel is active. I'm using LabVIEW 9.0f2 if that makes a difference...can someone verify the behavior of this in another version (set VI to floating).

 

frontmost.png

Message 4 of 18
(6,360 Views)

I don't have LV9 but are you sure that your reference is right "This VI". If you target the current VI, let the 'reference' connector empty.

If you are not sure link the 'error out' cluster to check that the reference is not empty.

0 Kudos
Message 5 of 18
(6,348 Views)

I just noticed that on the code snippet. I do have a constant VI reference connected to the property node, for some reason it made it a control when I created the snippet.

0 Kudos
Message 6 of 18
(6,344 Views)

Ok.

 

Test without constant ref or check it's not a 'Not a Refnum'

Do you use special settings as VI properties? Dialog, reentrant, ...

 

Think also to the error cluster.

0 Kudos
Message 7 of 18
(6,338 Views)
I know that using the constant reference works. I have tested the same code using the default window behavior and it functions as it should. I want to know if changing the window behavior to floating causes this property to behave incorrectly.
0 Kudos
Message 8 of 18
(6,334 Views)

(That's just the way code snippets work, nothing was done wrong)

 

back on topic:

 

In LV 8.2, the code "works", i.e. @ Floating, Frontmost = True

In LV 8.5, the code does not work, i.e. @ Floating, Frontmost = False.

 

I noticed in the Help re: Floating behavior, something was changed in 8.5. It says Focus will not immediately be relinquished when a floating window is selected (or something like that) and 8.2 does not mention that.

 

 

Message Edited by Broken Arrow on 12-23-2009 08:20 AM
Richard






0 Kudos
Message 9 of 18
(6,328 Views)

Ok, I didn't see that you use floating window.

 

It's explicity specified in the help that the function is ignored for floating windows.

 

Front Panel Window:Is Frontmost Property

Property of VI.

Indicates whether to bring the front panel to the front. This property applies only in the application instance of the calling VI.

If TRUE, LabVIEW brings the front panel to the front. If FALSE, the VI does nothing. If you read this property, it indicates whether the front panel window is the front window (ignoring floating windows).

 

0 Kudos
Message 10 of 18
(6,322 Views)