Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- {$mode objfpc}{$H+}
- interface
- uses
- Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids,
- StdCtrls;
- type
- { TForm1 }
- TForm1 = class(TForm)
- Button1: TButton;
- Edit1: TEdit;
- Edit2: TEdit;
- Edit3: TEdit;
- Edit4: TEdit;
- Edit5: TEdit;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- Label5: TLabel;
- sg: TStringGrid;
- procedure Button1Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { private declarations }
- public
- { public declarations }
- end;
- var
- Form1: TForm1;
- n:byte;
- empty:boolean;
- implementation
- {$R *.lfm}
- { TForm1 }
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- if (Edit1.Text<>'') and (Edit2.Text<>'') and (Edit3.Text<>'') and (Edit4.Text<>'') and (Edit5.Text<>'') then
- empty:=false
- else empty:=true;
- if empty=false then
- begin
- Edit1.Color:=clDefault;
- Edit2.Color:=clDefault;
- Edit3.Color:=clDefault;
- Edit4.Color:=clDefault;
- Edit5.Color:=clDefault;
- sg.Cells[0,n]:=Edit1.Text;
- sg.Cells[1,n]:=Edit2.Text;
- sg.Cells[2,n]:=Edit3.Text;
- sg.Cells[3,n]:=Edit4.Text;
- sg.Cells[4,n]:=Edit5.Text;
- Edit1.Text:='';
- Edit2.Text:='';
- Edit3.Text:='';
- Edit4.Text:='';
- Edit5.Text:='';
- inc(n);
- sg.RowCount:=sg.RowCount+1;
- end
- else
- begin
- ShowMessage('Pre pridanie udajov prosim vyplnte vsetky polia.');
- Edit1.Color:=$00D7D7FF;
- Edit2.Color:=$00D7D7FF;
- Edit3.Color:=$00D7D7FF;
- Edit4.Color:=$00D7D7FF;
- Edit5.Color:=$00D7D7FF;
- end;
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- n:=1;
- empty:=true;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment