02-18-2013 06:16 AM
When you try to duplicate a panel where a control has been dynamically created and associated to a splitter, you receive error -153: Item is already attached to splitter control.
See attached project which shows this behaviour: you can move the splitter and have controls moved accordingly; you can also duplicate the panel whith the splitter fully operative. If you press "Duplicate Numeric" button, existing numeric is duplicated and the new control is attached to the splitter. After this, trying to duplicate the panel generates error -153. If you duplicate the control but do not add it to the splitter no error is received while duplicating the panel.
Tested in CVI2009SP1. There is no evidence of this error in Known Issues document for later versions.
02-20-2013 08:49 AM
Going a little bit further on this subject, if Ifirst call RemoveCtrlFromSplitter and then duplicating the panel, I receive no error even if the panel has other controls attached to the splitter (provided they have been attache in the UIR editor, not programmatically).
02-20-2013 11:20 AM
Hi Roberto,
Thanks for the nicely stripped down test program! Easy to reproduce bugs are a rare pleasure...
I did confirm the bug, which has been there since CVI 7.1. It is triggered by the presence, at the time that the panel is copied, of a splitter-attached control, which was itself duplicated from another control that had been loaded from a UIR (whether or not the original control is also attached to the splitter). Whew. That was long.
In simpler terms, it's not the fact that the control was dynamically attached to the splitter that is causing the problem. It's the fact that the control was duplicated from another control.
The problem happens because a duplicated control inherits the constant name of the original control. Normally, this is not a problem for runtime-only controls. However, the splitter was still assuming that constant names of its attached controls were all unique, and that's what caused the problem.
Bug id: 392640
Unfortunately, there isn't a great workaround, since you can't prevent the duplicated control from inheriting the constant name, nor can you change its constant name after the fact. I can think of two possibilities:
Luis
02-20-2013 11:22 AM
Just noticed your update now, after posting my reply. Looks like you've already hit on workaround #2.
Sorry, it took me a while to look into this.
Luis
02-21-2013 03:57 AM
Thanks Luis for looking into this. Yes, I got into a workaround that is working for me so I'm ok on this.
LuisG ha scritto:
Easy to reproduce bugs are a rare pleasure...
Seems we are in the same world: every now and then I need to work on some customers bug notice but very often I cannot reproduce the exact situation! Just yesterday a person told me "can't you step through the whole program to try finding the error?"