Einzelnen Beitrag anzeigen

Benutzerbild von EccoBravo
EccoBravo

Registriert seit: 19. Okt 2004
Ort: Neuruppin
524 Beiträge
 
Delphi 2007 Architect
 
#3

Re: Wie zellsensitives Rechnen in StringGrid ?

  Alt 14. Dez 2005, 11:54
Nun aber neues Problem

Soweit so gut,
aber unter OnGetEditText wird im StringGrid erst nach zweimaligem Drücken der EnterTaste das richtige ergebnis ausgerechnet.
Nach einmaligem Enter kommt keinErg oder sinnloses Erg.

Zur Illustration hier mein Code
Delphi-Quellcode:
function StrToFloate(wert:String):single;
begin
    if wert ='then result :=0
    else result := StrToFloat(wert);
end;

procedure TForm1.SG1GetEditText(Sender: TObject; ACol,
  ARow: Integer; var Value: String);
begin
  if (aRow=1) then
  begin
      SG1.Cells[ACol,3]:= FloatToStr(StrToFloate(SG1.Cells[ACol,1])+StrToFloate(SG1.Cells[ACol,2]));
  end;
  if aRow=2 then
  begin
      SG1.Cells[ACol,3]:= FloatToStr(StrToFloate(SG1.Cells[ACol,1])+StrToFloate(SG1.Cells[ACol,2]));
  end;
  if aRow=3 then
  begin
      SG1.Cells[ACol,1]:= FloatToStr(StrToFloate(SG1.Cells[ACol,2])+StrToFloate(SG1.Cells[ACol,3]));
  end;
Danke

E. B.
  Mit Zitat antworten Zitat