Re: Deriving from custom forms in C++, is it possible?

From: Fireangel (Fireangel_at_discussions.microsoft.com)
Date: 08/17/04


Date: Tue, 17 Aug 2004 04:27:01 -0700


This is fireangel again, just at my work account..

The only other thing I can really think of is dealing with constructors. Do
you have any default constructors defined?? IE, FormA (void), FormB (void)??
 In order for the form to be "designed" (Displayed really), a default
constructor must exist. I guess the reason for this is that the designer
can't come up with default values to pass to into the form, and so just gives
up.

Did you rename any of the namespaces, project name, or file names?? I've
had some issues with renaming some stuff and the compiler barfing on me from
it. Basically, for the project, there is a "Default Namespace" which (in
your case) has to be Config. When you go to compile the form, the compiler
takes the default namespace, then form name to name all the resources. IE,
if your the default namespace was test1, the resource file name for FormA
would be FormA.test1.resources. FormB would be looking for a file name of
FormA.Config.resources (You can see the slight diff), and formB would die in
loading...

If you still have problems, why don't you email what you have to fireangel1
AT comcast DOT net. Its my home account (i'm off the rest of the week)..

Hope it helps

GE

"Vincent Finn" wrote:

> On Mon, 16 Aug 2004 17:09:01 -0700, Fireangel
> <Fireangel@discussions.microsoft.com> wrote:
>
> >
> >For a real answer, we kinda need more info. IE, what do you mean by "Not
> >being able to edit the inherited form"?? What are you trying to edit??
>
> I mean that when I try to open the form in the Design window (by
> double-clicking on the .h file) I get the following error
>
> --------------
> The designer could not be shown for this file because none of the
> classes within it can be designed. The designer inspected the
> following classes in the file:
>
> B --- The base class 'Config.A' could not be loaded. Ensure
> the assembly has been referenced or built if it is part of the
> project.
> --------------
>
> >Are you trying to edit the stuff (controls, menu bar, menu's) set up on the
> >first form?? almost everything in form A would be private, and so you
> >couldn't edit it in form b. Change them all to protected (Faster if you do
> >this by hand).
>
> Don't get that far although that would have been a question later
> since I noticed in C# that you don't get access to the events for
> buttons that are on the base form in the derived form.
> making them 'protected virtual' gives access although it is a bit
> messy that you can't get to the handler by double-clicking, I assume
> that'll be the same in C++
>
> >Next thing to check is namespaces. In order for form B to have any chance
> >of comming up in the form designer, it can only be wrapped inside of 1
> >namespace. IE namespace1::FormB is valid, Namespace1::SubNamespace1::FormB
> >will crash on you.
>
> They are both in the Config namespace (that is the project name)
> I tried using the 'Config::B' and simply 'B' but made no difference
>
> Any other suggestions?
>
> Vin
>


Loading