Mostrando postagens com marcador Demonstração dos eventos ongeteditmask. Mostrar todas as postagens
Mostrando postagens com marcador Demonstração dos eventos ongeteditmask. Mostrar todas as postagens

sábado, 17 de outubro de 2009

Demonstração dos eventos ongeteditmask, ongetedittext e onsetedittext do tstringgrid

Demonstração dos eventos OnGetEditMask, OnGetEditText e OnSetEditText do TStringGrid


//Os eventos OnGetEditMask, OnGetEditText e OnSetEditText ocorrem quando entramos no modo de edição.
procedure TForm1.StringGrid1GetEditMask(Sender: TObject; ACol,
ARow: Integer; var Value: String);
begin
if (ARow = 1) and (ACol = 1) then
Value := '(999) 999-9999;1;_'; // Telefone
end;


procedure TForm1.StringGrid1GetEditText(Sender: TObject; ACol,
ARow: Integer; var Value: String);
begin
if (ARow = 1) and (ACol = 2) then begin
if StringGrid1.Cells[ACol, ARow] = 'Ótimo' then
Value := '1'
else if StringGrid1.Cells[ACol, ARow] = 'Regular' then
Value := '2'
else if StringGrid1.Cells[ACol, ARow] = 'Ruim' then
Value := '3';
end;
end;


procedure TForm1.StringGrid1SetEditText(Sender: TObject; ACol,
ARow: Integer; const Value: String);
begin
if (ARow = 1) and (ACol = 2) then begin
if Value = '1' then
StringGrid1.Cells[ACol, ARow] := 'Ótimo'
else if Value = '2' then
StringGrid1.Cells[ACol, ARow] := 'Regular'
else if Value = '3' then
StringGrid1.Cells[ACol, ARow] := 'Ruim'
end;
end;


//By Nativo_Gyn