NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand Modal Window Hangs

Hi,

I am trying to prepare example how to use modal VIs in TestStand. But I myself do not know how to do it correctly 😄 Actually everything works well until I launch message box with method TS_EngineDisplayMessageBox. I found that this hang is somehow expected: http://digital.ni.com/public.nsf/allkb/621F0957FAC5EA72862579A5006CC001.

The proposed solution is to make VI non-modal, but my VI must be modal! Setting "Always run in the LabVIEW Run-Time Engine" option also does not work...

Any idea how to fix it?

I have attached the example which I am preparing.

You can launch Modal Window Test.seq. PreBatch will show TestStand Example.vi modal front panel, and then you will see Modal Window.vi (also modal). If you will try to enter empty serial number you should see error message box. After you click ok in error, you will not be able to do enything more - it will be hanged.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 1 of 8
(3,893 Views)

Without looking into your attachement: Did you include the "Start Modal" and "End Modal" methods in your popup?

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(3,859 Views)

Yes, I did. In both windows. Unfortunately there is no way to control this with Message Box method. I think I will need to use User32.dll to reproduce the functionality, because there's a possibility to set proper caller window reference.

https://msdn.microsoft.com/pl-pl/library/windows/desktop/ms645505(v=vs.85).aspx

 

Alternatively, I'll try to explicitly set caller window handler with Engine.AppMainHwnd.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 3 of 8
(3,846 Views)

I reviewed your example and obviously, you cannot "stack" a 'Display Message Box' on top of a modal popup (Start Modal Dialog).

That being said, there are two options:

1. End Modal Dialog before checking the SN. After check was done (Validate Serial Number.vi) 'Re-Start' Modal Dialog.
As a result, the SN entry dialog will disappear for the time the SN is validated. Which, as a benefit, enables the error message box to display properly. However, if no error popus up, the dialog flashes which might confuse the user.

2. Do not use the Display Message Box function from the TS API. Implement a custom LV based popup and show this one instead. (not tested, but should work)

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 4 of 8
(3,823 Views)

Thank you Norbert for your response.

I would like to refer to your suggestions.

Ad.1. It looks like bad UX. 

Ad.2. It looks like lot of work (User32 message box functionality replication in LabVIEW is like reinventing the wheel) and bad style. Better idea is to use this: https://msdn.microsoft.com/pl-pl/library/windows/desktop/ms645505(v=vs.85).aspx

I updated my example with user32 message box, with caller window handler and MB_SYSTEMMODAL flag, and now it works as charm.

 

IMO NI should add possibility to point caller window reference in TS API message box.

 

PS While I'm writing this I came out with the idea to try MB_SYSTEMMODAL flag with TS API. Since TS is using user32 message box in its API it might work also, provided that Engine.AppMainHwnd is properly updated and is used as a hWnd in user32 MessageBox function. I will try this tomorrow, because now is bed time 🙂

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 5 of 8
(3,802 Views)

Hello bienieck,

 

I wanted to check your example, but cannot, I have LV18 only.

Could you update the LVproject file?

Thank you in advance.

CsBihacker

0 Kudos
Message 6 of 8
(2,748 Views)

@CsBihacker wrote:

Hello bienieck,

 

I wanted to check your example, but cannot, I have LV18 only.

Could you update the LVproject file?

Thank you in advance.


Strange. The project from the first post is saved in LV2013, I'm opening it in LV2019, and you cannot open it in LV2018?

I'm attaching LV project saved to LV2018 (opened in LV2019).

 

 

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 7 of 8
(2,734 Views)

You are right. The problem was that TS could not load the LV project, because I don't have RTE 2013 installed.

Now I saved the project in LV2018, works fine 🙂

CsBihacker

0 Kudos
Message 8 of 8
(2,729 Views)