LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to use callbackData parameters with easytab control?

In my project I have an easytab control with three panels. I setup a callback function and the callbackData for the controls on the easytab panels. In this condition I receive a General Protection Error when clicking either on a panel or on a control on the panels. Look at the project attached to see the behaviour of the program.
The callbackData passed to the controls is the ID of a control in the main panel. The basic idea is that when the user modifies a control's value, the callback function associated with the control turns on the 'toSave' radio button: that way I can easily know if a control has been modified and warn the operator if he tries to exit the panel without saving datas.
This mec
hanism works well when all controls are on the same panels, but gives me the error when grouping controls on easytab panels.
If I comment all the SetCtrlAttribute (panel, control, ATTR_CALLBACK_DATA, (void *)Impo_toSave); statements, all works well.
How can I fix this?
Also, in the reduced project attached I get the GPF error on the DiscardPanel at the end of the program.
I'm using CVI 5.5.1 on Windows 98se.

Roberto


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 1 of 3
(3,109 Views)
Yes, there is a good explanation for this. The EasyTab control is actually converting one control (the canvas) into many controls. It handles the callbacks for this through "Callback chaining". There are functions for dealing with chained callbacks in the Programmer's Toolbox (toolslib\toolbox\toolbox.fp).

You can set the callback data before you load the panels into the easytabs and then retrieve that original data with GetChainedCallbackData. Unfortunately, the difficult task would be to set the callback data AFTER it is chained into an easy tab control. We don't have a function for that in the toolbox. We provide the source code for the toolbox functions to you, so you would need to look inside the source code for the chaining of callbacks to f
igure out how to set the callback data pointer after a control callback has been chained.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 3
(3,109 Views)
Chris,
I tried setting callbackData before adding panels to the easytab control and retrieving the callbackdata with GetChainedCallbackData and it works fine.

This solution is ok for my application, so I needn't to modify the toolbox (and avoid the struggle of updating it for every new version of cvi...).

Many thanks to you
Roberto


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 3 of 3
(3,109 Views)