Autor Beitrag
mk2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72

WIN 2000
D4 Prof
BeitragVerfasst: Fr 22.08.03 11:00 
Hi, hab da mal ne kleine Frage

in meinem Programm stell ich verschiedene Zahlen in einem String Grid dar. Der User kann bestimmte Bereiche dieser Tabelle markieren, um sie zum Beispiel über die Zwischenablage nach Excel zu kopieren.

Da, die Tabelle manchmal sehr groß ist möchte ich dem User den Menüpunkt 'Gesamte Tabelle markieren' anbieten. Dazu muß ich ja während der Laufzeit den markierten Bereich des StringGrid ändern. Wenn ich aber folgendes versuche:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
StringGrid1.Selection.Top:=0;
StringGrid1.Selection.Left:=0;
StringGrid1.Selection.Bottom:=StringGrid1.ColCount-1;
StringGrid1.Selection.Left:=StringGrid1.RowCount-1;


sagt mir Delphi:

ausblenden Quelltext
1:
[Error] window_tabelle.pas(2118): Left side cannot be assigned to					


Ich nehme mal an, das soll heißen die Property Selection vom StringGrid ist Read-only??

hat trotzdem jemand ne Ahnung wie ich das hinkriege?

MfG mk2
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Fr 22.08.03 13:32 
Hallo,

hier ein Beispiel aus der Delphi-Hilfe:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm1.Button1Click(Sender: TObject);
var
  myRect: TGridRect;
begin
  myRect.Left := 3;
  myRect.Top := 1;
  myRect.Right := 2;
  myRect.Bottom := 4;
  MyGrid.Selection := myRect;
end;

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
mk2 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72

WIN 2000
D4 Prof
BeitragVerfasst: Fr 22.08.03 14:25 
besten dank , hat funktioniert :D
Aton
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 125

Windows XP
D7 Enterprise
BeitragVerfasst: Mi 31.03.04 15:39 
Hallo,

wie kann ich machen, dass in meinem StringGrid keine einzige Zelle
markiert ist?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var myRect: TGridRect;

myRect.Left := -1;
myRect.Top := -1;
myRect.Right := -1;
myRect.Bottom := -1;
SG.Selection := myRect;


Das gibt einen Listenindexfehler. (Eigentlich logisch). Aber was kann
ich sonst machen? :autsch:

Danke, Gruß Jens.

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.
jojo-sp
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 317

Windows XP Prof, Vista Ultimate & Home Premium, Windows 7
Delphi 7 Enterprise, Delphi 2009
BeitragVerfasst: Do 12.08.04 10:09 
Titel: Auto-Scroll ohne Markierung
Ich habe leider keine Ahnung, ob du es schon Hinbekommen hast, ich hatte leider das gleiche Problem.
So hat das scrollen ohne Markieren geklappt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
myRect.Left := 0;
myRect.Top := zaehler; //Anzahl der Zeilen/rows im Stringgrid
myRect.Right := 1;
myRect.Bottom := zaehler;//Anzahl der Zeilen/rows im Stringgrid
Stringgrid1.Selection := myRect;

Viel Spaß noch... 8)

Moderiert von user profile iconTino: Code- durch Delphi-Tags ersetzt.