• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 589
  • Last Modified:

Creating Form Class

I have tried to create a form class containing a menu & some buttons & panels.
The class is registered in the repository, but when I create a form inheriting from the class I get a blank form without any of the controls

I guess I must have done something wrong???
0
DCLSyntect
Asked:
DCLSyntect
  • 4
  • 3
1 Solution
 
ITugayCommented:
Hi DCLSyntect
yes, seems you did something wrong.

Any form with controls can be added to repository. You do not need to register class if your form has no additional properties. And then new form can be created from repository with all controls on it.

I suppose that you do something extra. Also check out for empty form with the same file name.

____
Igor
0
 
DCLSyntectAuthor Commented:
I have had another look.

If I choose "Copy" then it works fine, but "inherit" still has no controls on it.
0
 
DCLSyntectAuthor Commented:
Is there a limit to the number of levels of inheritance?
The form in question is not based on TFrom, but my own form class, which in turn is based on TForm.
The hierachy would be:
TForm -> MyForm (properties, but no controls) -> My 2nd Form (with controls) -> New problem form (that does not show controls, but does show the properties from 'MyForm')
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ITugayCommented:
Hi DCLSyntect,

>> Is there a limit to the number of levels of inheritance?
do not noticed.

Seems I have to do some experiments...
I will contact you later.




____
Igor
0
 
ITugayCommented:
Hi DCLSyntect,

ok, I do some test and here is resume.

1. Create your FIRST form with all procedures properies and events.
*** Do not put any components there.
code should be something lik this:

unit frmMyForm;
interface
uses
  Windows, ....., StdCtrls;

type
  TFMyForm = class(TForm)
  private
    FOnDoSomething: TNotifyEvent;
    FSomeProperty: Integer;
  public
   
  published
    property OnDoSomething: TNotifyEvent read FOnDoSomething write FOnDoSomething;
    property SomeProperty: Integer read FSomeProperty write FSomeProperty;
  end;

procedure Register;

implementation

uses
  DesignIntf, Designeditors;

{$R *.dfm}

procedure Register;
begin
  RegisterCustomModule(TFMyForm, TCustomModule);
end;


end.

2. Create package file. Add FIRST form there and add DesignIDE to requires section.
3. Compile and install package.
4. Add FIRST form to repository.

now for has all events and properties visible in object inspector

--------------------------

5. Create new SECOND form using 'inherits' option.
6. Drop components on SECOND form
7. Save SECOND form to object repository

now you can use it with components and custom properties and events.

--------------------------
Create rest of forms using SECOND form template with 'inherits' option.
____
Igor
0
 
DCLSyntectAuthor Commented:
Thanks Igor

I think I confused things because I tried to follow the same procedure with Form 2 as I did with Form 1.

I have made it again and all seems OK now
0
 
kimherreroCommented:
Hi,

I'm developing a hierarchy of forms, and the base class adds just two
events, so I did exactly as ITugay showed in the sample. The package
builds ok, add the form to repository, all is all right.

But when I create a new project, and add new form inherited from that
class, it goes to the unit, and that unit depends on DesignXXX, so I run into
the same problem again, I can't compile becasue of the abscence of
Proxies.dcu.

How to solve that ?

Kim
0
 
DCLSyntectAuthor Commented:
Hi Kim

I'm not sure if this will solve your problem, but I have looked at my projects, and noticed that the "Build with Runtime packages" box is ticked - you may also need to add DesignIDE to the list of packages used by the project.

I think I got around this by accident, but can't remember how...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now