Solved

Frames question

Posted on 2000-04-16
10
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

717 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