GamerSK

tabulka

Apr 12th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.78 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids,
  9.   StdCtrls;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     Button1: TButton;
  17.     Edit1: TEdit;
  18.     Edit2: TEdit;
  19.     Edit3: TEdit;
  20.     Edit4: TEdit;
  21.     Edit5: TEdit;
  22.     Label1: TLabel;
  23.     Label2: TLabel;
  24.     Label3: TLabel;
  25.     Label4: TLabel;
  26.     Label5: TLabel;
  27.     sg: TStringGrid;
  28.     procedure Button1Click(Sender: TObject);
  29.     procedure FormCreate(Sender: TObject);
  30.   private
  31.     { private declarations }
  32.   public
  33.     { public declarations }
  34.   end;
  35.  
  36. var
  37.   Form1: TForm1;
  38.   n:byte;
  39.   empty:boolean;
  40.  
  41. implementation
  42.  
  43. {$R *.lfm}
  44.  
  45. { TForm1 }
  46.  
  47.  
  48. procedure TForm1.Button1Click(Sender: TObject);
  49. begin
  50.   if (Edit1.Text<>'') and (Edit2.Text<>'') and (Edit3.Text<>'') and (Edit4.Text<>'') and (Edit5.Text<>'') then
  51.     empty:=false
  52.   else empty:=true;
  53.   if empty=false then
  54.     begin
  55.       Edit1.Color:=clDefault;
  56.       Edit2.Color:=clDefault;
  57.       Edit3.Color:=clDefault;
  58.       Edit4.Color:=clDefault;
  59.       Edit5.Color:=clDefault;
  60.       sg.Cells[0,n]:=Edit1.Text;
  61.       sg.Cells[1,n]:=Edit2.Text;
  62.       sg.Cells[2,n]:=Edit3.Text;
  63.       sg.Cells[3,n]:=Edit4.Text;
  64.       sg.Cells[4,n]:=Edit5.Text;
  65.       Edit1.Text:='';
  66.       Edit2.Text:='';
  67.       Edit3.Text:='';
  68.       Edit4.Text:='';
  69.       Edit5.Text:='';
  70.       inc(n);
  71.       sg.RowCount:=sg.RowCount+1;
  72.     end
  73.   else
  74.     begin
  75.       ShowMessage('Pre pridanie udajov prosim vyplnte vsetky polia.');
  76.       Edit1.Color:=$00D7D7FF;
  77.       Edit2.Color:=$00D7D7FF;
  78.       Edit3.Color:=$00D7D7FF;
  79.       Edit4.Color:=$00D7D7FF;
  80.       Edit5.Color:=$00D7D7FF;
  81.     end;
  82. end;
  83.  
  84. procedure TForm1.FormCreate(Sender: TObject);
  85. begin
  86.   n:=1;
  87.   empty:=true;
  88. end;
  89.  
  90. end.
Advertisement
Add Comment
Please, Sign In to add comment