Board index » delphi » oldCreateOrder doesn't seem to work

oldCreateOrder doesn't seem to work

Has anybody tried to use the oldCreateOrder property for Delphi 5 forms?
We've tried to set this property to false, but it appears that the VCL code
overrides our setting and makes oldCreateOrder true.

As always, Thanks!

Scott

 

Re:oldCreateOrder doesn't seem to work


On Thu, 22 Jun 2000 10:07:21 -0400, "Scott Stephenson"

Quote
<stephenson_sc...@emc.com> wrote:
>We've tried to set this property to false

Cannot replicate, D5, Service Pack 1.
--
Rick Rogers (TeamB)
www.fenestra.com and www.componentfactory.com

Re:oldCreateOrder doesn't seem to work


Rick,

I leftout part of the problem defininion (I'm relaying the question for a
teammate). The property does work well for a single form, but he's using
form inheritance, and his problem is that he wants to override the property
in the lowest member of the inheritance heirarchy.
He's written a sample program that demonstrates the problem in action. Would
you like me to email it to you?

Thanks for the help!

Scott
Rick Rogers (TeamB) <r...@fenestra.com> wrote in message
news:f484lsgduf6gmjir7imo41l8c0inotnl3v@4ax.com...

Quote
> On Thu, 22 Jun 2000 10:07:21 -0400, "Scott Stephenson"
> <stephenson_sc...@emc.com> wrote:

> >We've tried to set this property to false

> Cannot replicate, D5, Service Pack 1.
> --
> Rick Rogers (TeamB)
> www.fenestra.com and www.componentfactory.com

Re:oldCreateOrder doesn't seem to work


On Fri, 23 Jun 2000 09:41:07 -0400, "scott stephenson"

Quote
<stephenson_sc...@emc.com> wrote:
> Would you like me to email it to you?

No thanks, I prefer to keep discussions here on the newsgroups, where
others can learn from and participate in the exchange of knowledge.
You should be able to post enough of an example in the text of a short
newsgroup message, if not then you haven't simplified the problem
enough.

Quote
> his problem is that he wants to override the property
> in the lowest member of the inheritance heirarchy.

Anyway, this doesn't really make sense. I would suggest to your
colleague that they use the new creation order everywhere in their
project, trying to use it in some places and not others is a recipe
for confusion, long-term maintenance problems, and bugs.
--
Rick Rogers (TeamB)
www.fenestra.com and www.componentfactory.com

Re:oldCreateOrder doesn't seem to work


Rick,

I AM trying to use the new creation order, it just doesn't work for
inherited forms - VCL forces the OLD creation order..

try this:

TForm1 = class(TForm)
  public
    constructor create(aOwner: TComponent); override;
...
end;

TForm2 = class(TForm1)
  public
    constructor create(aOwner: TComponent); override;
...
end;

check the creation order for TForm1 vs. the creation order for TForm2.

gadi.

"Rick Rogers (TeamB)" <r...@fenestra.com> wrote in message
news:tqt6lsko7ho40iggctep8s505eskfasvqa@4ax.com...

Quote
> On Fri, 23 Jun 2000 09:41:07 -0400, "scott stephenson"
> <stephenson_sc...@emc.com> wrote:

> > Would you like me to email it to you?

> No thanks, I prefer to keep discussions here on the newsgroups, where
> others can learn from and participate in the exchange of knowledge.
> You should be able to post enough of an example in the text of a short
> newsgroup message, if not then you haven't simplified the problem
> enough.

> > his problem is that he wants to override the property
> > in the lowest member of the inheritance heirarchy.

> Anyway, this doesn't really make sense. I would suggest to your
> colleague that they use the new creation order everywhere in their
> project, trying to use it in some places and not others is a recipe
> for confusion, long-term maintenance problems, and bugs.
> --
> Rick Rogers (TeamB)
> www.fenestra.com and www.componentfactory.com

Re:oldCreateOrder doesn't seem to work


On Fri, 23 Jun 2000 15:21:37 -0400, "gadi shavit"

Quote
<shavit_g...@emc.com> wrote:
> check the creation order for TForm1 vs. the creation order
> for TForm2.

Both are False, as expected, tested under D5.01. Below is fully
compilable test code. Something is different in your code that you
haven't shown.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TForm2 = class(TForm1);

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  Form: TForm2;
begin
  Form := TForm2.Create(Self);
  try
    if Form.OldCreateOrder then
      ShowMessage('True')
    else
      ShowMessage('False');
    if OldCreateOrder then
      ShowMessage('True')
    else
      ShowMessage('False');
  finally
    Form.Free;
  end;
end;

end.
--
Rick Rogers (TeamB)
www.fenestra.com and www.componentfactory.com

Re:oldCreateOrder doesn't seem to work


you are right on this one, but try form inheritence through the "New Items"
dialog box, the current project tab.
somthing like this:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  public
    constructor create(aOwner: TComponent); override;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses
  unit2;

const
  cStrBool: array[boolean] of string = ('false', 'true');

constructor TForm1.create(aOwner: TComponent);
var
  s: string;
begin
  s := cStrBool[oldCreateOrder];
  inherited;
  s := s + ', ' + cStrBool[oldCreateOrder];
  showMessage('create: ' + classname + '; ' + s);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  s: string;
begin
  s := cStrBool[oldCreateOrder];
  showMessage('form create: ' + classname + '; ' + s);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  form: TForm2;
begin
  form := TForm2.Create(self);
end;

end.

------------------------------------------------
{unit1.dfm}

object Form1: TForm1
  Left = 331
  Top = 256
  Width = 325
  Height = 117
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Button2: TButton
    Left = 104
    Top = 16
    Width = 97
    Height = 25
    Caption = 'VCL inheritence'
    TabOrder = 0
    OnClick = Button2Click
  end
end

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

unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Unit1, StdCtrls;

type
  TForm2 = class(TForm1)
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.DFM}

end.

------------------------------------------------
{unit2.dfm}

inherited Form2: TForm2
  Caption = 'Form2'
  OldCreateOrder = True
  PixelsPerInch = 96
  TextHeight = 13
end

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

"Rick Rogers (TeamB)" <r...@fenestra.com> wrote in message
news:fdnels01c556it3ou9p1q3qcqmbhj8is4f@4ax.com...

Quote
> On Fri, 23 Jun 2000 15:21:37 -0400, "gadi shavit"
> <shavit_g...@emc.com> wrote:

> > check the creation order for TForm1 vs. the creation order
> > for TForm2.

> Both are False, as expected, tested under D5.01. Below is fully
> compilable test code. Something is different in your code that you
> haven't shown.

> unit Unit1;

> interface

> uses
>   Windows, Messages, SysUtils, Classes, Graphics, Controls,
>   Forms, Dialogs, StdCtrls;

> type
>   TForm1 = class(TForm)
>     Button1: TButton;
>     procedure Button1Click(Sender: TObject);
>   private
>     { Private declarations }
>   public
>     { Public declarations }
>   end;

>   TForm2 = class(TForm1);

> var
>   Form1: TForm1;

> implementation

> {$R *.DFM}

> procedure TForm1.Button1Click(Sender: TObject);
> var
>   Form: TForm2;
> begin
>   Form := TForm2.Create(Self);
>   try
>     if Form.OldCreateOrder then
>       ShowMessage('True')
>     else
>       ShowMessage('False');
>     if OldCreateOrder then
>       ShowMessage('True')
>     else
>       ShowMessage('False');
>   finally
>     Form.Free;
>   end;
> end;

> end.
> --
> Rick Rogers (TeamB)
> www.fenestra.com and www.componentfactory.com

Re:oldCreateOrder doesn't seem to work


Rick,

I was sure I had already replied to this message... apparently I hadn't.

you are right - in this example it works (both OldCreateOrder = false).
BUT - try doing form inheritance through "New Item" dialog. the
OldCreateOrder of the inherited form is set, by VCL, to true. (see the call
to InitInheritedComponent in TCustomForm.Create)

gadi.

"Rick Rogers (TeamB)" <r...@fenestra.com> wrote in message
news:fdnels01c556it3ou9p1q3qcqmbhj8is4f@4ax.com...

Quote
> On Fri, 23 Jun 2000 15:21:37 -0400, "gadi shavit"
> <shavit_g...@emc.com> wrote:

> > check the creation order for TForm1 vs. the creation order
> > for TForm2.

> Both are False, as expected, tested under D5.01. Below is fully
> compilable test code. Something is different in your code that you
> haven't shown.

> unit Unit1;

> interface

> uses
>   Windows, Messages, SysUtils, Classes, Graphics, Controls,
>   Forms, Dialogs, StdCtrls;

> type
>   TForm1 = class(TForm)
>     Button1: TButton;
>     procedure Button1Click(Sender: TObject);
>   private
>     { Private declarations }
>   public
>     { Public declarations }
>   end;

>   TForm2 = class(TForm1);

> var
>   Form1: TForm1;

> implementation

> {$R *.DFM}

> procedure TForm1.Button1Click(Sender: TObject);
> var
>   Form: TForm2;
> begin
>   Form := TForm2.Create(Self);
>   try
>     if Form.OldCreateOrder then
>       ShowMessage('True')
>     else
>       ShowMessage('False');
>     if OldCreateOrder then
>       ShowMessage('True')
>     else
>       ShowMessage('False');
>   finally
>     Form.Free;
>   end;
> end;

> end.
> --
> Rick Rogers (TeamB)
> www.fenestra.com and www.componentfactory.com

Other Threads