?
Solved

Frames question

Posted on 2000-04-16
10
Medium Priority
?
224 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
Independent Software Vendors: 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 800 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

770 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