unit LaskuriFrame; {------------------------------------------------------------------------------} { Unit Name: LaskuriFrame Purpose : Show usage of frames Author : Vesa Lappalainen Date : 07.10.2001 Changed : ToDo : Frame is a specialized "form" that is used to maintain lot of similar (look/behaviour) component groups. Making frame: 1) To create new Frame choose File/New/Frame 2) Drop needed components to frame 3) Do events needed 4) Add "interface", in this example Nollaa-procedure In form where you need frame: 1) Choose component Frames from Standard palette 2) Choose Frame you need. 3) Chanage properties to frame AND components inside the frame If component is changed on frame, then it is changed also everywhere the frame is used. If component is changed where frame is used, other instances of that frame remains unchanged. } {------------------------------------------------------------------------------} interface uses SysUtils, Types, {$ifdef CLX} QGraphics, QControls, QForms, QDialogs, QStdCtrls, {$else} Graphics, Controls, Forms, Dialogs, StdCtrls, {$endif} Classes; type TFrameLaskuri = class(TFrame) ButtonLaske: TButton; LabelLaskuri: TLabel; procedure ButtonLaskeClick(Sender: TObject); private { Private declarations } public { Public declarations } procedure Nollaa; end; implementation {$ifdef CLX} {$R *.xfm} {$else} {$R *.dfm} {$endif} procedure TFrameLaskuri.ButtonLaskeClick(Sender: TObject); begin LabelLaskuri.Caption := IntToStr(StrToIntDef(LabelLaskuri.Caption,0)+1); end; procedure TFrameLaskuri.Nollaa; begin LabelLaskuri.Caption := '0'; end; end.