LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

checking if a panel is valid

I have a program with a number of sub-panels that I load with LoadPanelEx(). So far so good. I create the sub-panels with "parent panel" = 0 so that they have their own minimize/maximize/close buttons. How can the main program know when a sub panel has been closed (using its own close button/callback function) so that it doesn't try to talk to it again? I can call some panel function and look for a "invalid panel ID" error return, but there should be a cleaner way. I can't find any function that tells me if a panel handle is valid or not.
0 Kudos
Message 1 of 3
(3,435 Views)
There is not an automatic method to do so: one possibility you have is to invalidate the panel handle in the callback that closes it. I suppose the panel handles are saved into gobal variables for the program to access them, so in the panel callback where the EVENT_CLOSE is handled you can set the corresponding variable to 0. All call to functions related to the subpanels should be made only after checking that the panel handle is non-zero.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,430 Views)

That's the problem: the sub-panel in question is in a completely different dll than the parent window, and doesn't have access to the parent windows globals (nor should it). If the sub-panel closes itself there's no way of signaling the parent unless I put in a "PanelHandleValid" function (which is what I did).

 

I'd like to suggest that some such function be made part of the NI User Interface toolbox.

0 Kudos
Message 3 of 3
(3,428 Views)