Autor Beitrag
Kawa
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45
Erhaltene Danke: 1



BeitragVerfasst: Sa 24.12.05 16:27 
Ich möchte den folgenden Quellcode in eine Procedure über einen Button aufrufen!
Wie mache ich das?

abgleitet von Stringgridsetedittext

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
const
  spalte: integer = 1;

procedure gridText(grd:TStringgrid;Sender: TObject; ACol, ARow: Integer; const Value: String);
 var
    x: integer;
    Ergebnis: Double;

 begin
    Ergebnis := 0;
  for x := grd.fixedRows to grd.RowCount - 2 do
  try Ergebnis := Ergebnis +
StrToFloat(Stringreplace(grd.Cells[spalte,x],'.','',[rfReplaceAll]));
  except end;
  grd.Cells[spalte,grd.RowCount-1]:=FloatToStr(Ergebnis);
  end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 gridtext(stringgrid1);  // <<----- hier meckert  der Compiler!
end;


Moderiert von user profile iconNarses: Quote- durch Delphi-Tags ersetzt
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Sa 24.12.05 17:13 
user profile iconKawa hat folgendes geschrieben:
Ich möchte den folgenden Quellcode in eine Procedure über einen Button aufrufen!
Wie mache ich das?

abgleitet von Stringgridsetedittext

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
const
  spalte: integer = 1;

procedure gridText(grd:TStringgrid;Sender: TObject; ACol, ARow: Integer; const Value: String);
 var
    x: integer;
    Ergebnis: Double;

 begin
    Ergebnis := 0;
  for x := grd.fixedRows to grd.RowCount - 2 do
  try Ergebnis := Ergebnis +
StrToFloat(Stringreplace(grd.Cells[spalte,x],'.','',[rfReplaceAll]));
  except end;
  grd.Cells[spalte,grd.RowCount-1]:=FloatToStr(Ergebnis);
  end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 gridtext(stringgrid1);  // <<----- hier meckert  der Compiler!
end;

guck dir mal die erwarteten parameter an, da fehlt einiges, die sind nämlich nicht freiwillig :lol:

versuchs mal so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Button1Click(Sender: TObject);
var 
  astr: string;
begin
  gridtext(stringgrid1, sender, 0, 0, astr);
end;

wenn sender nicht geht, dann probier self, die beiden nullen sind die x und y koordinaten um das richtige item auszuwählen ;)
Kawa Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45
Erhaltene Danke: 1



BeitragVerfasst: Sa 24.12.05 17:30 
super es geht ,
danke dir !