StrataFrame Forum

Visual Inheritance and PanelManager

http://forum.strataframe.net/Topic4713.aspx

By Andria Jensen - 11/21/2006

I am using visual inheritance extensively and have created a number of "base forms" to use.  One I am working on at the moment is using the PanelManager and has several Pages.  This works fine and the code executes correctly.  However, when I try to look at the inherited form in the designer I get "Duplicate component name 'PageBlank'. Component names must be unique and case-insensitive." for each page that I have in the PanelManager.  Basically, it looks like it's trying to recreate those components in the inherited form when it really doesn't need to.  Any idea on how I can get around this?  I know VI has some issues, but DevExpress has helped with a lot of those and I am usually able to make it work right.  Any help would be great.
By Andria Jensen - 11/28/2006

I am still having this issue.  I have this error coming up every time I try to look at the inherited form in the designer.  Is there a workaround here?  I don't understand why it's trying to recreate the panel pages, but I don't have a problem with any of the other controls...including panels that are outside of a panel manager.  It seems to be only the panels contained within a panel manager.  Right now I have to go into the designer code and delete the references to the panels every time I want to look at this form in the designer.  I really need this to work correctly.
By StrataFrame Team - 11/28/2006

The problem is with the forms designer... it reflects over your form to determine the properties that need to be serialized into the InitializeComponent() method.  So, when you add your pages the first time, they are added to the InitializeComponent() method.  However, when you inherit the form, and open the subform in the designer, it reflects over the object again, sees those pages and thinks it needs to add them to the subform's InitializeComponent() method because it doesn't know that they've already been added to the superclass's InitializeComponent() (for that matter, it doesn't even know that there is already an InitializeComponent() method in the superclass, so...). 

Unfortunately, you cannot access the Me.DesignMode property of a control within the constructor (because the property hasn't been set yet).  So, you'll have to come up with some other type of flag that will indicate whether the form is within design mode, and if it's not in design mode (meaning it's runtime), you'll want to Clear() the pages collection of the panel manager before the InitializeComponent() is called in the inherited form.

By Andria Jensen - 11/28/2006

 

Ok, I get what you are saying...what I don't get is why this is a problem here and not other places.  Why is this the only control giving me a problem?  I have done what you suggested and cleared the page collection before the InitializeComponent inside the constructor.  This did not change anything for me.  Any other suggestions?