Solved

Frames question

Posted on 2000-04-16
10
216 Views
Last Modified: 2010-04-04
Hi,

Is it possible to load different frames in a single container, I need to create a wizard, I think using different Forms (frames) will be easier. But When I select the frame container, it asks me what frame to use, and I see no option to load another frame. or unload one.
Or should I create the container at runtime, when needed?? if so how?

Any hints tips or advice, on making wizards is appreciated, Since they will be graphic heavy, I need to keep the memory load low. And I know using panels just eats up memory. because they are all created at runtime. While the forms are not. Is this also the case for Frames?

Thanks
Marc
0
Comment
Question by:hellfire052497
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 2720693
You can dynamically create frames you build in the designer. Below the source of the main unit (unit1). It uses unit2 which has a few components on it.
Button1 creates an instance of the frame (defined in unit2) and shows it on the main form.
Button2 removes it.


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 }
    Frame: TFrame;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Frame := TFrame2.Create(Self);
  Frame.SetBounds(150, 100, 200, 200);
  Frame.Parent := Self;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Frame.Free;
end;

end.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2720710
Please take a look at my plugin-interface demo too:

http://www5.ewebcity.com/epsylon/download.asp?file=PluginInterface.zip


Regards,

Epsylon.
0
 
LVL 1

Expert Comment

by:flooder
ID: 2721702
To unload a frame simply delete it.
Two put two frames on one form simply select one put in on the form and select the next one. If you want two frames acting as one, make a third frame that consists of the two previous frames and drop this single third frame on your form. The demo in delphi directory  \\demos\frames\db\...
is also a good example of frame capibilities and mixing frames and databases.

Cheers
Gerhardus
0
 
LVL 1

Expert Comment

by:flooder
ID: 2721714
If your frame is dropped on the form in design time it is created when you start you application because it is then only a fancy container. Epsylon's demo will work fine to create a frame dynamically just make sure that the frames unit is included in the forms uses clause that want to create it.

Weereens Groete
Gerhardus
0
 
LVL 5

Expert Comment

by:tzxie2000
ID: 2725135
Using table control with be more easy.
But using table control may need more memory.
If you apreciate with it,I can provide some code for you.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:hellfire052497
ID: 2727820
Hi all,

Thanks for the info, Epsylon's first solution is exactly what I had in mind. So Epsylon if you want to lock the question, so I can give you the points.

Thanks
Marc
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 200 total points
ID: 2727845
Hi Marc, if you need more info, feel free to ask.

Thanks for the points and regards,

Epsylon.
0
 

Author Comment

by:hellfire052497
ID: 2741312
Hi Epsylon,

I have one question left. I cannot find an Oncreate event with frames. I normally use this to initialize stuff.

Any idea how to do this with a Frame??

Thanks
Marc
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2745134
Hi Marc, in the frame-unit you can override the constructor and add aditional code like this:


unit Unit2;

interface

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

type
  TFrame2 = class(TFrame)
    Edit1: TEdit;
  private
    { Private declarations }
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
  end;

implementation

{$R *.DFM}

{ TFrame2 }

constructor TFrame2.Create(AOwner: TComponent);
begin
  inherited;
  // out your own stuff here
end;

end.
0
 

Author Comment

by:hellfire052497
ID: 2748229
Hi Epsylon,

Thanks for the info. It just reminded me why I love Delphi so much ;-)

Take Care
Marc
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

896 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now