DQMH Consortium Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

DQMH in sub panel with key focus

Solved!
Go to solution

Hi,

In my current project I am using several DQMH modules that can be displayed during a test sequence for the user. Each of these user interface modules are to be loaded into a subpanel with certain ones requiring a particular control to be made focus using the key focus property node.

 

This is where I’ve come across an issue with my code – the key focus property node doesn’t work when the module is displayed in a sub panel. This is an issue for the project as this is a main feature in the project.

 

Any suggestions on how to get this feature working would be most appreciated.

 

Thanks

 

Matthew

0 Kudos
Message 1 of 7
(1,970 Views)

There's something else going on in your code, I verified that setting key focus of a control in a subpanel should work fine. See the attached example and run the main VI (saved in LabVIEW 2020). After a second, you'll see the numeric control in the subpanel gets key focus and you can modify its value with the keyboard.

 

If you can attach a simple project that demonstrates the issue I can help you troubleshoot it.

Download All
Message 2 of 7
(1,953 Views)

Hi Darren,

 

Thank you for confirming that the key focus routine will work in a sub panel.

As requested, – please see the attached sample project which only contains the main module (server) which has the sub panel and the UI module (Manual Test) in question that should have key focus on the indicated control. Sample saved in LabVIEW 2017.

 

In the server module press the green play button to display the Manual Test in the sub panel.

 

I’m not sure if something else is happening to take the key focus away from the indicated control.

The key focus is set in the Set display & the Show in sub panel states of the UI module.

 

Thanks Matthew

0 Kudos
Message 3 of 7
(1,897 Views)
Solution
Accepted by matt26

You have a race condition in your code. The VI must be displayed in the subpanel before setting the KeyFocus. More generally, a front panel must be visible before setting KeyFocus has any effect. Here's what I did to fix the issue in your code:

 

race.png

 

The Merge Errors function enforces data flow such that the VI is inserted into the SubPanel before setting KeyFocus.

Message 4 of 7
(1,887 Views)

I'd like to point out that you aren't actually using LabVIEW Sub Panels.   You are using some kind of MDI code that just uses the sub panel as a location definer.  You never actually use "Insert VI" into the sub panel, and your MDI window is floating just above the sub panel.  Actual use of the sub panel would not give the "window-in-a-window" MDI effect I assume you want, but it would be a lot simpler.

Message 5 of 7
(1,883 Views)

Hi Darren,

 

Thank you for your help in resolving this issue.

I will amend my code for this fix to prevent any further race conditions.

 

Thanks Matthew

0 Kudos
Message 6 of 7
(1,877 Views)

That is true – the code is using win32 API calls to mimic a MDI interface. I agree that a sub panel approach would be simpler, but the end user likes MDI style interfaces and likes to be able to have an image that can be displayed in the container window.

0 Kudos
Message 7 of 7
(1,874 Views)