Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to use a TPanel as a host for child windows ( MDI simulation) (2) Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Oct-02
Category
Others
Language
Delphi 2.x
Views
95
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

Does anyone know if it is possible to change the Parent of the Mainform's client 
window in such a way that MDI forms are correctly displayed within (for instance) a 
panel?

Answer:

Here is a class that we use to place forms in panels:

1   unit oSubForm;
2   
3   interface
4   
5   uses
6     Forms, Controls;
7   
8   type
9     TSubForm = class(TForm)
10    public
11      procedure CreateParams(var Params: TCreateParams); override;
12      { ... }
13      function SetUp: boolean; virtual;
14      function Activate: boolean; virtual;
15      function Deactivate: boolean; virtual;
16      function Validate: boolean; virtual;
17      function AddKnockOnChanged(Sender: TObject): boolean; virtual;
18      { ... }
19      procedure SetAllChanged; virtual;
20    end;
21  
22  type
23    TDfEE_Form = class(TForm)
24    private
25    protected
26    public
27      function PageValidate(nPage: integer): boolean; virtual;
28    published
29    end;
30  
31  implementation
32  
33  uses
34    WinTypes;
35  
36  procedure TSubForm.CreateParams(var Params: TCreateParams);
37  begin
38    inherited CreateParams(Params);
39    with Params do
40    begin
41      WndParent := TWinControl(Owner).Handle;
42      Params.Style := WS_CHILD or WS_CLIPSIBLINGS or WS_CLIPCHILDREN;
43    end;
44    Align := alClient;
45    Parent := TWinControl(Owner);
46  end;
47  
48  function TSubForm.SetUp: boolean;
49  begin
50  end;
51  
52  function TSubForm.Activate: boolean;
53  begin
54  end;
55  
56  function TSubForm.Deactivate: boolean;
57  begin
58  end;
59  
60  procedure TSubForm.SetAllChanged;
61  begin
62  end;
63  
64  function TSubForm.Validate: boolean;
65  begin
66  end;
67  
68  function TSubForm.AddKnockOnChanged(Sender: TObject): boolean;
69  begin
70  end;
71  
72  function TDfEE_Form.PageValidate(nPage: integer): boolean;
73  begin
74    result := True;
75  end;
76  
77  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC