LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to set a window as active window?

I want to switch between 2 (or more) frontpanels by using the keyboard.
I have a boolean control assigned to a special key on every frontpanel.
When the key is pressed, a CASE is executed with a property node in it.

At the moment I'm setting the property "FP.IsDialog" for the window to
be active and resetting this property for all other windows. This works,
but I have to switch the windows by keyboard, as the mouse is "disabled"
by this property.
When I use the property "FP.IsFrontmost" instead, then I can switch from
the first window to the second, but NOT backwards (with the same diagram,
only changed the property). Why? I would prefer this property, as the user
can switch the window by keyboard AND mouse...

Any hints?

Backgroun
d: I like to control a program by keyboard and use the mouse
only when (really) needed. I think, it's easier... So switching through
different programs in Windows is easy with Ctrl-Tab, but that doesn't
work when you want to switch between 2 LabVIEW frontpanels.

Best regards,
Gerd Wieczorek
0 Kudos
Message 1 of 5
(5,099 Views)
Hi Gerd,

follow this link:
http://zone.ni.com/devzone/explprog.nsf/webmain/EBF11DD1F0FEAEF3862566790072A983?opendocument&node=DZ53008_US
You find a huge set of useful functions based on Windows API.
Use the Make Windows always on top.vi you find in the WINUTIL.LLB.
You can use it to activate-deactivate a windows progammatically by entering its correct name.

Good luck,

Alberto
0 Kudos
Message 2 of 5
(5,099 Views)
Well, error found. (Never close a refnum before using
it...).

Thanks anyway for the tip on lvwutil32!

Gerd
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 5
(5,099 Views)
You don't mention which version of LV you are using. At some point,
either 6.0 or 6.1, Ctl-Tab started working in LV as well.

Greg McKaskle
0 Kudos
Message 4 of 5
(5,099 Views)
I'm using LV6.1.
New problem encountered: Ctlr-Tab is working with with
"normal" LabView-programs, but when creating an Exe,
it doesn't work anymore...
After exploring the Ctrl-Tab (one day before your comment)
I removed my own code to do the switching. Today I
created the Exe and now I have to put this code back
into my program. Why doesn't Ctrl-Tab work in an
Executable?

Gerd Wieczorek
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 5
(5,099 Views)