Doug Hale wrote:
> It seams to me that the proper way to combine multiple visual objects
> together into one visual object is exactly what TFrame is all about.
>
You create a Tframe just as you would a Tform. You add the button
behavior to the frame.
The TFrame the becomes a visual object that you can drop on a form.
A very simple example:
program Project;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Frame2: TFrame};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Unit2;
type
TForm1 = class(TForm)
Frame21: TFrame2;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
object Form1: TForm1
Left = 333
Top = 191
Width = 979
Height = 563
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
inline Frame21: TFrame2
Left = 352
Top = 80
Width = 201
Height = 249
TabOrder = 0
inherited TreeView1: TTreeView
Width = 184
end
end
end
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, ComCtrls, StdCtrls;
type
TFrame2 = class(TFrame)
Button1: TButton;
TreeView1: TTreeView;
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
end.
object Frame2: TFrame2
Left = 0
Top = 0
Width = 320
Height = 337
TabOrder = 0
object Button1: TButton
Left = 0
Top = 0
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
end
object TreeView1: TTreeView
Left = 0
Top = 25
Width = 320
Height = 312
Align = alBottom
Indent = 19
TabOrder = 1
end
end