LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Close Buttons in the Title Bar of Child Windows?

Hello to all,
it seems not to be possible to have the Windows common "Close", "Maximize"
and "Minimize" buttons in the title bar of a CVI child panel. So it is not
possible to generate a close event without a close control on this kind of
panel.
Is this correct, or is there a workaround?

Thanks
Torsten
0 Kudos
Message 1 of 8
(5,044 Views)
I used a simple workaround by using a command button control (with an X in the control title) shaped square, located in the upper right corner of my panel. Then used its callback to close the panel. It looks good, but probably not quite as good as the standard Windows titlebar buttons.

I will track this thread in hopes of learning other ways to do this. But in the meantime, this works.

Hope this helps.
Craig
0 Kudos
Message 2 of 8
(5,044 Views)
FYI

The Windows close button uses the Marlett font letter 'r'. Unfortunately, the label won't center on a command button, and with anything else the label gets the focus so the button won't operate. You can get quite close tho.
0 Kudos
Message 3 of 8
(5,044 Views)
Torste,

This is the expected behavior. CVI child panels do not behave the same as top-level windows. Thus the "missing" buttons. If you would like to simulate a multiple-document interface app, you can take a look at the following CVI example on NI's external website:

http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/341192d4aeb035e486256ac40078a4e8?OpenDocument

With this example you can have child panels that include the typical close, maximize and minimize buttons.

Regards,

Azucena Perez
National Instruments
0 Kudos
Message 4 of 8
(5,044 Views)
Great question, and we do get this one a lot. The solution posted by the other customer was creative and does work just as well.
Another option is possible. We always suggest that users create a control button which is designed to exit the running application. When you generate all code, you have an option of setting a selected control callback to contain the QuitUserInterface(). If you check one here, I believe that CVI automatically will tie your X click box from windows to this control callback, and thus quit your running application when you click the X.
If you didn't do this when you first generated the code, don't fear. Double click on your panel, and under the panel settings you see an option for "Close Control" This is the X button. When you change this to
a specified callback, this is where the application will navigate to when your end user hits the X button.
0 Kudos
Message 5 of 8
(5,044 Views)
Whoops. You put child panels. I missed this at first. Check aperez's response below. Great example attached. Sorry, it's Thursday, brain overloaded.
0 Kudos
Message 6 of 8
(5,044 Views)
I haven't had much luck with using the CLOSE CONTROL. Clicking on the "X" didn't seem to ever call the CLOSE CONTROL function.

I've found that setting up a call back for the panel and then using EVENT_CLOSE works.
0 Kudos
Message 7 of 8
(5,044 Views)

Dead address in message 4.

 

And users still wanting to do this, 20 years later.

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