unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, ExtCtrls,
  UConsts, USg;


type
  TMainForm = class(TForm)
    Panel1: TPanel;
    Image1: TImage;
    sg: TStringGrid;
    procedure sgGetEditText(Sender: TObject; ACol, ARow: Integer;
      var Value: string);
    procedure sgGetEditMask(Sender: TObject; ACol, ARow: Integer;
      var Value: string);
    procedure FormShow(Sender: TObject);
    procedure Image1Click(Sender: TObject);

  private
	 procedure Koniec();
  public

  end;

var
  MainForm: TMainForm;

implementation
{$R *.dfm}
{------------------------------------------------------------------------------}
procedure TMainForm.Image1Click(Sender: TObject);
begin
	Koniec();
end;

procedure TMainForm.Koniec();
begin
	if Application.MessageBox('Koniec pracy', 'Uwaga', MB_ICONINFORMATION or MB_YESNO) = mrYes then
	begin
		Close();
   end;
end;

procedure TMainForm.sgGetEditMask(Sender: TObject; ACol, ARow: Integer; var Value: string);
begin
	if ACol = colTel then
   begin
      Value := '(999) 000 00 00;1';
	end;
end;

procedure TMainForm.sgGetEditText(Sender: TObject; ACol, ARow: Integer; var Value: string);
begin
	if ACol = colMiasto then
   begin
      Value := AnsiUpperCase(Value);
   end;
end;

procedure TMainForm.FormShow(Sender: TObject);
var
	ob : MSg;

begin
	sg.Align := alClient;

	ob := MSg.Create(sg);
   ob.Wypelnij();
   FreeAndNil(ob);

   ActiveControl := sg;
end;

end.
