?
Solved

Creating Form Class

Posted on 2003-03-25
8
Medium Priority
?
583 Views
Last Modified: 2010-04-04
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
Comment
Question by:DCLSyntect
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 9

Expert Comment

by:ITugay
ID: 8209663
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
 

Author Comment

by:DCLSyntect
ID: 8214592
I have had another look.

If I choose "Copy" then it works fine, but "inherit" still has no controls on it.
0
 

Author Comment

by:DCLSyntect
ID: 8215050
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 9

Expert Comment

by:ITugay
ID: 8215361
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
 
LVL 9

Accepted Solution

by:
ITugay earned 200 total points
ID: 8215559
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
 

Author Comment

by:DCLSyntect
ID: 8222389
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
 

Expert Comment

by:kimherrero
ID: 8563712
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
 

Author Comment

by:DCLSyntect
ID: 8603123
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

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question