Recent

Author Topic: Initializing TFrame private variables. Where?  (Read 8011 times)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Initializing TFrame private variables. Where?
« on: April 29, 2010, 12:38:48 am »
TFrame doesn't have OnCreate or something similar. So how can I initialize its private variables?

Imants

  • Full Member
  • ***
  • Posts: 196
Re: Initializing TFrame private variables. Where?
« Reply #1 on: April 29, 2010, 05:11:47 am »
Just override existing constructor like this:

  TFrame1 = class(TFrame)
  private
    MyVar: Integer;
  public
    constructor Create(TheOwner: TComponent); override;
  end;


.....

constructor TFrame1.Create(TheOwner: TComponent);
begin
  inherited Create(TheOwner);
  MyVar := 0;
end;

Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Initializing TFrame private variables. Where?
« Reply #2 on: April 29, 2010, 07:47:57 am »
Hahaha... I guess I was too sleepy to think about it. Thanks.

wOvAN

  • New Member
  • *
  • Posts: 47
    • wxSoft.Ru
Re: Initializing TFrame private variables. Where?
« Reply #3 on: April 29, 2010, 11:30:01 am »
Code: [Select]
  Frame1 = class(TFrame)
  public
    { public declarations }
    procedure AfterConstruction; override;
    procedure BeforeDestruction; override;
  end;

mas steindorff

  • Hero Member
  • *****
  • Posts: 532
Re: Initializing TFrame private variables. Where?
« Reply #4 on: April 30, 2010, 02:15:49 am »
since were on frames....
I have a project that uses a TFrame. 
When I Update the Frame's looks at design time, the copies on the form do not change.
When I run the program, all looks and works well. 

Is there an easy way to update the frames I've placed other than to delete them and add them back in?
windows 10 &11, Ubuntu 21+ - fpc 3.0.4, IDE 2.0 general releases

Imants

  • Full Member
  • ***
  • Posts: 196
Re: Initializing TFrame private variables. Where?
« Reply #5 on: April 30, 2010, 05:38:59 am »
I think the esyest vhay is to close and then open again those files where your frame copy is.

mas steindorff

  • Hero Member
  • *****
  • Posts: 532
Re: Initializing TFrame private variables. Where?
« Reply #6 on: April 30, 2010, 10:19:41 pm »
Wow, it works!  I tried closing the IDE and the same old frame would appeared after I restarted it.
Your advice to just close the form and then reopen it works like a charm ;D  Thanks
windows 10 &11, Ubuntu 21+ - fpc 3.0.4, IDE 2.0 general releases

 

TinyPortal © 2005-2018