LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

add buttons to title bar

To answer your first question, you can simply call the default proc for that window (DefWindowProc function). This will result in bypassing the original proc for the panel (defined in the CVI runtime) but it will still call the standard window proc for that type of window. Again, given the code that you attached, this should *not* happen. It's just a fail-safe. You might want to put an Assert statement in there as well.

As for your second question, why is it that the panel disappears when the user hits the close icon? In a standard CVI panel, that only happens if you: 1. handle the EVENT_CLOSE event in the panel's callback, or 2. associate the close icon with a control in your panel, via the ATTR_CLOSE_CONTROL attribute, in which
case an EVENT_COMMIT is sent to this control's callback. In any case, the panel should only go away if you explicitly discard it when processing these events. And if you are explicitly discarding it, can't you clean up the panel id from the functions at that point? I must be missing something, because I'm not understanding the situation very well.

Luis
0 Kudos
Message 11 of 14
(1,309 Views)
Hello again Luis,

You seem well experienced if you point out the options for the close icon. I had at first a panel callback that included a case for EVENT_CLOSE. Later I replaced this with a (hidden) discard button that was linked to the close icon.
The error I mentioned when running in Debug mode, once in a while occurs when I close one of the Open GL panels. The error always occurs if I close the main panel with the quit button. As I expect that Windows 2000 and Windows XP do close all finished threads, I am not too worried. But it does annoy me.

While I do not expect you to check the source, I have added it. Maybe you want to see what I did with the panel and control callback. You need two instrument drivers fro
m the toolslib: custctrl\cviogl and toolbox\toolbox

Have a nice day, Jos
0 Kudos
Message 12 of 14
(1,309 Views)
Jos,

As a general rule it is not a good idea to discard a panel (or a control) inside the callback function for that panel (or control). You are doing this inside the callback for the Quit control.
Under normal conditions, CVI can work around this, but what you are doing here is kind of non-traditional (mixing the SDK with the CVI UI Library) on top of some more very non-traditional stuff that the ogl control is doing, so it's not surprising that a stale deferred callback is causing the internal error (even though the error is harmless).
What you should do is to move the following code:

for (i = 0; i < OPGLMAXPANELS; i++)
OpenglControlDiscard(i);

from the callback to the main function, *after* RunUse
rInterface returns. That should make the error go away.

- luis
0 Kudos
Message 13 of 14
(1,309 Views)
Thanks Luis.

That is a change in code that is simple to do.

Jos
0 Kudos
Message 14 of 14
(1,309 Views)