08-12-2015 09:12 AM
I'm using InstallPopup to create a modal dialog. This is working fine.
However I need a way to indicate to the operator that this is a modal
dialog. For example, in the CVI environment, if you select "Save Project As...", a FileSelect type
popup appears, but if you attempt to click on another window the FileSelect popup will blink
it's frame and beep. I need to implement something like this for my popup's.
Any Ideas?
Thanks!
Angie
08-13-2015 01:28 PM
Angie,
What you're looking for is an event that triggers when the user clicks outside the modal dialog box; you can then configure a cvi callback to capture and handle that event. The CVI events list can be found here:http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/uiref/cvievents_overview/
Here's a useful community example illustrating events and event callbacks: https://decibel.ni.com/content/docs/DOC-25363
This case is a bit more difficult because you're essentially trying to capture a nonevent--an attempt to change the UI element focus that will fail because of the modality of the dialog box. I'd look into using the EVENT_LOST_FOCUS event (http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/uiref/cvieventlostfocus/) and see if it can be triggered by a modal dialog box.
08-14-2015 08:12 AM
Thanks Captain,
Unfortunately the modal will not see the EVENT_LOST_FOCUS. I even tried using a regular panel (i.e. no popup), and on EVENT_LOST_FOCUS, using SetActivePanel to set the focus back to the panel to simulate a popup, but that didn’t work either. While keyboard input was redirected back, the mouse input was not. This is proving to be much more difficult than I would have expected.
Is there any documentation available that defines which events the popup panel can access?
Angie
08-15-2015 03:44 AM
As an additiona suggestion, which I cannot test at the moment, you could try with a regular panel shown with DisplayPanel with two additional provisions:
1. Set the panel as floating at least when app is active. This can be done in the UIR editor by going to advanced panel attributes dialog
2. In the panel callback, insert a SetActivePanel (panel); in LOST_FOCUS event code: this will set focus back to the panel
08-17-2015 08:38 AM
Thanks Roberto,
I'm afraid that doesn't work either. Using SetActivePanel will re-direct keyboard inputs back to the panel, but it does not re-direct mouse inputs.
My issue with this whole thing, is that sometimes the operator gets frustrated, not realizing that they must respond to this modal panel before continuing.
My application can have many windows open at once, and sometimes it's necessary to use a modal, but it's difficult to distinguish it from other normal windows. I've tried setting the panel background to a different color for modals, but it's not the elegant solution I'm looking for.
Angie
08-19-2015 01:33 PM
Angie,
The only way I can think of would be to register a windows event in CVI, then key off of that event. The Windows API should have an event case for this.