Changed the TCUstomForm create function. I am getting it ready to read the resources to auto-create the controls...

Anslo changes TScreen.AddForm and TScreen.RemoveForm.  They were being passed TFOrm's instead of TCustomForms.
Shane

git-svn-id: trunk@24 -
This commit is contained in:
lazarus 2000-08-09 14:15:04 +00:00
parent 44ff6adb20
commit 109626d9c4
4 changed files with 56 additions and 15 deletions

View File

@ -132,6 +132,7 @@ type
property OnCloseQuery : TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery stored IsForm;
public
constructor Create(AOwner: TComponent); override;
constructor CreateNew(AOwner: TComponent; Num : Integer); virtual;
procedure BeforeDestruction; override;
destructor Destroy; override;
procedure Close;
@ -175,11 +176,11 @@ type
Function GetForms(IIndex: Integer): TForm;
function GetHeight : Integer;
function GetWidth : Integer;
procedure AddForm(FForm: TCustomForm);
procedure RemoveForm(FForm: TCustomForm);
public
constructor Create(AOwner : TComponent); override;
Destructor Destroy; Override;
procedure FAddForm(FForm: TForm); // TODO: if you know any other way, please implement it
procedure FRemoveForm(FForm: TForm); // TODO: if you know any other way, please implement it
property FormCount: Integer read GetFormCount;
property Forms[Index: Integer]: TForm read GetForms;
property PixelsPerInch : integer read FPixelsPerInch;

View File

@ -488,19 +488,60 @@ end;
{------------------------------------------------------------------------------}
constructor TCustomForm.Create(AOwner : TComponent);
begin
try
CreateNew(AOwner, 1);
if (ClassType <> TForm) and not (csDesigning in ComponentState) then
begin
Include(FFormState, fsCreating);
try
// if not InitInheritedComponent(Self, TForm) then
// raise EResNotFound.CreateFmt('Resource %s not found', [ClassName]);
finally
Exclude(FFormState, fsCreating);
end;
end;
finally
end;
end;
constructor TCustomForm.CreateNew(AOwner: TComponent; Num : Integer);
Begin
Writeln('CREATING TCUSTOMFORM!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
FBorderStyle:= bsSizeable;
inherited Create(AOwner);
fCompStyle:= csForm;
fCompStyle:= csForm;
FFormState := [];
FMenu := nil;
ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents,
csSetCaption, csDoubleClicks];
Left := 0;
Top := 0;
Width := 320;
Height := 240;
Visible := False;
ParentColor := False;
ParentFont := False;
Ctl3D := True;
// FBorderIcons := [biSystemMenu, biMinimize, biMaximize];
FBorderStyle := bsSizeable;
FWindowState := wsNormal;
// FDefaultMonitor := dmActiveForm;
// FIcon := TIcon.Create;
// FIcon.OnChange := IconChanged;
// FInCMParentBiDiModeChanged := False;
{apply a drawing surface}
FCanvas := TControlCanvas.Create;
FCanvas.Control := Self;
FKeyPreview := False;
Color := clBtnface;
end;
// FPixelsPerInch := Screen.PixelsPerInch;
// FPrintScale := poProportional;
// FloatingDockSiteClass := TWinControlClass(ClassType);
Screen.AddForm(Self);
End;
{------------------------------------------------------------------------------}
{ TCustomForm CreateParams }
@ -730,6 +771,12 @@ end;
{ =============================================================================
$Log$
Revision 1.3 2000/08/09 14:15:04 lazarus
Changed the TCUstomForm create function. I am getting it ready to read the resources to auto-create the controls...
Anslo changes TScreen.AddForm and TScreen.RemoveForm. They were being passed TFOrm's instead of TCustomForms.
Shane
Revision 1.2 2000/07/23 19:01:33 lazarus
menus will be destroyed now, stoppok

View File

@ -14,13 +14,6 @@ end;
constructor TForm.Create(AOwner : TComponent);
begin
inherited Create(AOwner);
{setup default size properties}
Top := 1;
Left := 1;
Width := 120;
Height := 120;
end;

View File

@ -37,13 +37,13 @@ end;
{------------------------------------------------------------------------------
Function: TScreen.FAddForm
Function: TScreen.AddForm
Params: FForm: The form to be added
Returns: Nothing
Do not use this procedure. This procedure is used by TScreen internally.
------------------------------------------------------------------------------}
procedure TScreen.FAddForm(FForm: TForm);
procedure TScreen.AddForm(FForm: TCustomForm);
begin
FFormList.Add(FForm);
end;
@ -105,13 +105,13 @@ end;
{------------------------------------------------------------------------------
Function: TScreen.FRemoveForm
Function: TScreen.RemoveForm
Params: FForm: The form to be removed
Returns: Nothing
Do not use this procedure. This procedure is used by TScreen internally.
------------------------------------------------------------------------------}
procedure TScreen.FRemoveForm(FForm: TForm);
procedure TScreen.RemoveForm(FForm: TCustomForm);
begin
FFormList.Remove(FForm);
end;