LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GPF + ChainPanelCallback -> theory

Solved!
Go to solution

So I've been making a nifty library based in party by the time control library I made.  This new one takes a panel handle and turns chains a new callback onto it for handling proper sizing/scaling/moving the panel and its controls.  It's code that I tend to copy & paste a lot between projects, and which requires a lot of global variables and messy initialization.

 

So a lib made sense to me.  I got it all done and then implemented into a fairly large project which has five panels that called the lib.  But one of them was causing GPFs on a table on two different click events (Row/Col, and Right).  

 

I tracked it down to my usage in that table callback of assigning panel callbackData.

 

So here's my theory: whenever you do a callback chain (or possibly install as well, see my other post here), it's likely that the callbackData (if any) is getting corrupted on the stack, and therefore later when you pop it back off, it's not there.

 

Thoughts?

 

 

 

0 Kudos
Message 1 of 6
(3,306 Views)
Solution
Accepted by topic author ElectroLund

The correct usage of ChainpanelCallback and ChainCtrlCallbck is that if you have to assign callbackData value you must do this before chaining the new callbacks to the panel/control. This depends on ChainSomething functions already assigning a value to callbackData parameter; those functions are designed to keep existing callbackData values safe after chaining the new callback, but if you change callbackData value after chaining the new callback you alter the mechanism ending up in GPF errors.



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 6
(3,294 Views)

Ah, I see.  Wow, that's unfortunate, as it makes my library very heavy-handed.  Other than good documentation (ha!), another designer could get into real trouble with it like I have.  And the GPF of course gives very little explanation.

 

In this case, I was assigning UUT indexes to my panel callbackData so that other callback functions could retrieve it, all in an effort to keep the variables local. Oh well, onward and upward... I'll do some rethinking of this method.

 

Thanks!

0 Kudos
Message 3 of 6
(3,269 Views)

You can use the GetChainedPanelCallbackData / SetChainedPanelCallbackData functions to get and set callback data for callbacks that have been chained.

0 Kudos
Message 4 of 6
(3,096 Views)

Hi Luis, those are commands that I never used. Just to be sure, with them I am manipulating the callbackData of the original callback set for the panel/control or that of the function chained afterwards? I ma thinking to some scenario where I would like to change the callbackData of the original callback function but if I'm not wrong I can't.



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 5 of 6
(3,092 Views)

Hi Roberto,

 

You can use it to either get/set the original data (by passing an empty string as the type name), or to get/set data that was subsequently chained (by passing the type name that was used to chain the callback).

 

If you take a look at the old, obsolete tabbed panels implementation (toolslib\custctrl\easytab.c) you can see an example of how these functions can be used.

 

Luis

0 Kudos
Message 6 of 6
(3,051 Views)