LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Error when discarding duplicated control with tool tip

Hello,
 
I have a control and I attached a tool tip to it, using SetCtrlToolTipAttribute. When I duplicate this control, the duplicated control can not be discarded. If I discard this duplicated control I get the error message "Attempt to free pointer to memory not allocated by malloc() or realloc()". Note that the tool tip doesn't show when the mouse is over the duplicated control.
 
I created a little dummy project to make things clear. It is attached to this message. 
0 Kudos
Message 1 of 4
(3,294 Views)
This may happen due to the intrinsic structure of tooltip functions: basically SetCtrlToolTipAttribute chains a new callback to the control to display the tooltip. Given this, you cannot duplicate the control because the callback chaining is not automatically created for the new callback so that the tooltip is not shown and you may find this kind of errors.
 
Your project works well if you FIRST duplicate the control and THEN attach the tooltip: the tooltip os normally shown on the duplicated control and it can be discarded without 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?
Message 2 of 4
(3,289 Views)

Hello Roberto,

OK, I understand what the problem is. Unfortunately the solution of first duplicating the control and then attaching the tooltip is not suitable for my project. The controls are duplicated in case the User takes certain actions, while the tooltips are attached before running the User Interface. I tried to remove the tooltip using SetCtrlToolTipAttribute (panel, control, CTRL_TOOLTIP_ATTR_ENABLE, 0), but appearantly this doesn't remove the callback chaining on the control. Is there any way to completely remove a tooltip? I could use UnchainCtrlCallback but I don't know the typeName parameter for this function...

0 Kudos
Message 3 of 4
(3,288 Views)

Hi Roberto,

Appearantly when I use the function InstallCtrlCallback (panel, control, NULL, 0) on the duplicated control, I get no errors when it is discarded.

0 Kudos
Message 4 of 4
(3,281 Views)