Autor Beitrag
adler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Fr 06.02.04 23:11 
Hi!

Hab im I-Net gestöbert und siehe da!
www.swissdelphicente.../showcode.php?id=882
Doch leider Zeigt er in der Zeile
ausblenden Delphi-Quelltext
1:
2:
3:
//...
      if ColCount(FixedCols + 1) then ColCount := (ColCount - 1);
//...

bei FixedCols nen Fehler an.

Hoffe auf Hilfe ;)

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Fr 06.02.04 23:14 
Hallo,

leitest du auch eine Klasse von tSringGrid ab oder versuchst du es so im Code zu nutzen?

Gruß
Klabautermann
adler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Fr 06.02.04 23:25 
?

Hab so ne Klasse Declariert, weil ich das auch für Zeile usw habe.
ausblenden Delphi-Quelltext
1:
TStringGridHack(StringGrid1).DeleteCol(stringgrid1.col);					

So hab ichs mal aufgerufen.

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.
uruz
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 09.02.04 13:22 
gruess dich adler,

der fehler liegt wohl hier
statt...
adler hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
//...
  if ColCount(FixedCols + 1) then ColCount := (ColCount - 1);
//...



...solltest du schreiben...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
//...
  if (ColCount > FixedCols + 1)  then 
    ColCount := (ColCount - 1);
//...


zumindest gehe ich mal davon aus, dass du spaltenweise von rechts nach links loeschen magst... wichtig ist aber, sobald du die letzte "Nicht-Fixed-Spalte" erreicht hast, dass du die Spalte nicht mehr loeschen darfst... kannst aber dann die Felder noch leeren:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
//...
  for i := FixedRows to RowCount - 1 do 
    Cells[FixedCols, i] := '';
//...


uruz
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 09.02.04 16:21 
adler hat folgendes geschrieben:
Doch leider Zeigt er in der Zeile {...} bei FixedCols nen Fehler an.

Und wie lautet der Fehler?

Gruß
Tino
adler Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 511

Windows XP
Delphi 05 Pers
BeitragVerfasst: Di 10.02.04 20:41 
Hi
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TStringGridHack.DeleteCol(ACol: Longint);
begin
  if ACol = FixedCols then if ACol = (ColCount - 1) then
    begin
      Cols[ACol].Clear;

      if (ColCount > FixedCols + 1)  then
      ColCount := (ColCount - 1);
    end
    else
    begin
      Cols[ACol] := Cols[ACol + 1];
      DeleteCol(ACol + 1);
    end;
end;

Kein Fehler und keine funktionalität.

_________________
Wo's nix zu gucken gibt, gibts vielleicht was zu hören.