Sometimes what people want is not what they need!
David Smith wrote: > > The user asking the question needed it to be part of the sub-classed > component he was making (don't know why). > > Dave > > --- On *Thu, 1/8/09, Doug Hale /<del...@doughale.com>/* wrote: > > From: Doug Hale <del...@doughale.com> > Subject: [advanced_delphi] TFrame > To: advanced_delphi@yahoogroups.com > Date: Thursday, January 8, 2009, 10:01 AM > > 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 > > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.176 / Virus Database: 270.10.5/1881 - Release Date: 1/7/2009 > 5:59 PM > >