-
Notifications
You must be signed in to change notification settings - Fork 1
/
FrameTelefon.pas
executable file
·79 lines (69 loc) · 2.27 KB
/
FrameTelefon.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{====================================Modul FrameTelefon============================
U njemu se nalaze procedure, funkcije i varijable za Freme Telefon. U Frameu se
nalaze polja Broj i Opis koja predstavljaju broj telefona i opis istog.
===================================================================================}
unit FrameTelefon;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TfTelefon = class(TFrame)
edOpis: TEdit;
edBroj: TEdit;
shSel: TShape;
procedure SetSelection(s:boolean);
function GetSelection:boolean;
procedure FrameEnter(Sender: TObject);
procedure FrameClick(Sender: TObject);
private
{ Private declarations }
public
constructor Create(AOwner:TComponent);
property Selected:boolean read GetSelection write SetSelection;
end;
implementation
{$R *.dfm}
{procedure SetSelection
pokazuje okvir koji oznacuje da je Frame selektiran ovisno o tome
jeli "s" true ili false.}
procedure TfTelefon.SetSelection(s:boolean);
begin
shsel.Visible:=s;
end;
{function GetSelection
vraca vrijednost jeli vidljiv okvir koji pokazuje da je Frame selektiran
ili nije.}
function TfTelefon.GetSelection:boolean;
begin
result:=shsel.Visible;
end;
{constructor Create
izvrsava se prlikom kreiranja svakog Frame Telefon te ga smjesta na
odgovarajuce mjesto u Frame-u Telefoni.}
constructor TfTelefon.Create(AOwner:TComponent);
begin
inherited create(AOwner);
if owner.ComponentCount>1 then top:=(owner.Components[owner.ComponentCount-2] as TfTelefon).top+height
else Top:=0;
end;
{procedure FrameEnter
izvrsava se prilikom stvljanja kursora u Frame. Tada prikazuje
okvir koji oznacava da je Frame selektiran.}
procedure TfTelefon.FrameEnter(Sender: TObject);
var
i:integer;
begin
for i:=0 to owner.ComponentCount-1 do
if owner.FindComponent('tel'+inttostr(i)).Name<>self.Name then
if (owner.Components[i] as TfTelefon).Selected then (owner.Components[i] as TfTelefon).Selected:=false;
selected:=true;
end;
{procedure FrameClick
izvrsava se pritiskom na Frame misem. Stavlja kursor za unos
na polje Broj.}
procedure TfTelefon.FrameClick(Sender: TObject);
begin
edBroj.SetFocus;
end;
end.