06-27-2018 05:03 PM
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?
Solved! Go to Solution.
06-27-2018 05:56 PM
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.
06-28-2018 07:16 AM
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!
07-06-2018 10:26 AM
You can use the GetChainedPanelCallbackData / SetChainedPanelCallbackData functions to get and set callback data for callbacks that have been chained.
07-06-2018 10:37 AM
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.
07-13-2018 06:17 PM
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