LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Totally new for LabWindows/CVI

Hello.
I'm totally new for CVI.
I want get event when a user want close window (click to "x" window button).
In Library/User Interface/Callback Functions it not found.

Please help me.
0 Kudos
Message 1 of 10
(4,186 Views)
The callback that you want is the panel callback for the panel that is having its "x" clicked.

Make sure that you specify a callback in the panel definition dialog box:
- Open the .uir file and double click the panel you want to configure
- In the second box down, enter a callback name, if one is not already specified.
- Click OK to close the dialog box.
- Save your .uir file.

Use the LabWindows CVI code generator to generate a callback for that panel:
- Left click once on the panel that you want to generate a callback for.
- Select Code->Set Target File from the menu, and select the file in which you want to place the callback function.
- Select Code->Generate->Panel Callback from the menu.
- Press Ctrl-P to view the n
ewly created callback function in the file you specified.

When the user clicks the "x", an EVENT_CLOSE is generated. Inside the callback function you'll see the case EVENT_CLOSE: section. This is where the program control will go when the "x" is clicked.

Hope this helps.
Message 2 of 10
(4,186 Views)
Thank you very much.
0 Kudos
Message 3 of 10
(4,186 Views)
There's very little documentation on what is probably the first feature
you'd want to use when starting with CVI. It's interesting that most of the
sample progs come with unnecessary 'QUIT' buttons that just take up space.

"Craig Leidholm" wrote in message
news:506500000005000000A6760000-1019262487000@exchange.ni.com...
> The callback that you want is the panel callback for the panel that is
> having its "x" clicked.
>
> Make sure that you specify a callback in the panel definition dialog
> box:
> - Open the .uir file and double click the panel you want to
> configure
> - In the second box down, enter a callback name, if one is not
> already specified.
> - Click OK to close the dialog box.
> - Save your .uir file.
>
> Use the
LabWindows CVI code generator to generate a callback for that
> panel:
> - Left click once on the panel that you want to generate a callback
> for.
> - Select Code->Set Target File from the menu, and select the file
> in which you want to place the callback function.
> - Select Code->Generate->Panel Callback from the menu.
> - Press Ctrl-P to view the newly created callback function in the
> file you specified.
>
> When the user clicks the "x", an EVENT_CLOSE is generated. Inside the
> callback function you'll see the case EVENT_CLOSE: section. This is
> where the program control will go when the "x" is clicked.
>
> Hope this helps.
0 Kudos
Message 4 of 10
(4,186 Views)
Actually, the Quit button or some quit control is required for the X to work in closing the panel. The X for the panel calls the callback of the specified "Close Control" control for the panel in the panel settings. If there is no Close Control, the X doesn't function. You can have a Close Control that is not visible if you don't want to have a visible quit button, but you have to have one. That is why they are in our examples.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 5 of 10
(4,186 Views)
Really? I just created a small sample with no quit control in the panel. And I created a panel callback function in which I called QuitUserInterface(0).

It seems to work fine. Is this not the proper way to do it?

Take a look at the sample code and uir.
Download All
0 Kudos
Message 6 of 10
(4,186 Views)
Whoops. Let me redo the attachments for that last reply.
Download All
0 Kudos
Message 7 of 10
(4,186 Views)
Oops, sorry I misstated. The only way to have the X work WITHOUT writing your own code for the User Interface to shutdown is to have a Close Control. The way you did it is perfectly fine, but if you would have just dropped a Custom Control->Quit button and moved it off the visible panel area, you wouldn't have had to write any code. Code generation would have done all the work

Chris
0 Kudos
Message 8 of 10
(4,186 Views)
Sorry Chris, but simply defining a callback function for the panel and then
ticking it under the program termination dialog (generate all code) does the
trick. No buttons required.


"Chris Matthews" wrote in message
news:506500000005000000E4760000-1019262487000@exchange.ni.com...
> Oops, sorry I misstated. The only way to have the X work WITHOUT
> writing your own code for the User Interface to shutdown is to have a
> Close Control. The way you did it is perfectly fine, but if you would
> have just dropped a Custom Control->Quit button and moved it off the
> visible panel area, you wouldn't have had to write any code. Code
> generation would have done all the work
>
> Chris
0 Kudos
Message 9 of 10
(4,186 Views)
You are correct. I stand corrected.

Chris
0 Kudos
Message 10 of 10
(4,186 Views)