
February 23rd, 2009, 09:03 AM
|
|
Registered User
|
|
Join Date: Feb 2009
Posts: 1
Time spent in forums: 37 m 23 sec
Reputation Power: 0
|
|
|
TFrame descendant strange behavior
I need to create a TFrame descendant frame class, that will be the base for some other frame descendants. I called this class TFrameGeneric:
Code:
unit UnitFrameGeneric;
interface
uses
UnitObjects,
Forms, ComCtrls;
type
TFrameGeneric = class (TFrame)
public
OwnerTreeNode: TTreeNode;
OwnerEntity: TEntity;
end;
implementation
end.
One descendant of this generic class looks like this:
Code:
unit UnitFrameDevice;
interface
uses
UnitFrameGeneric, UnitObjects,
StdCtrls, ExtCtrls, ComCtrls, Classes, Controls;
type
TFrameDevice = class(TFrameGeneric)
GroupBoxDevice: TGroupBox;
EditAddress: TLabeledEdit;
UpDownAddress: TUpDown;
EditDevName: TLabeledEdit;
procedure EditAddressChange(Sender: TObject);
private
public
end;
implementation
{$R *.dfm}
procedure TFrameDevice.EditAddressChange(Sender: TObject);
begin
OwnerEntity.UpdateTitles;
end;
end.
The problem I encouuntered is that the design view for TFrameDevice does not look like a frame designer anymore, but like a form designer! Also, it inherits properties from TForm, like ClientWidth, ClientHeight, and others. The code compiles ok, but when the application dynamically creates a TFrameDevice, it pops up an exception saying that "Project XYZ has raised an exception class EReadError with message 'property ClientHeight does not exist'".
Why does TFrameDevice class have properties from TForm? How can I avoid this?
I am using CodeGear Delphi for Win32 2007 Professional with latest updates (I hope... I have December 2007 installed).
|