Autor Beitrag
Lemon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 96

Win XP
D5 Standart
BeitragVerfasst: Fr 02.04.04 15:02 
hallo,

folgendes problem:

auf meiner form gibt es einen button, ueber den man neue registerkarten eines pagecontrol erstellen kann, die jeweils ein neues stringgrid enthalten.
soweit so gut, das geht ja alles.
dann gibt es da noch einen button, mit dem man alle stringgrids und registerkarten wieder loeschen kann. das geht auch, aber nur, wenn in einer zelle des stringgrids keine textmarke ist, d.h. wenn nicht versucht wird im stringgrid zu schreiben. ist dies der fall, dann gibt es eine fehlermeldung von wegen zugriffsverletzung.
wie bekomme ich es jetzt hin, dass ich dieses problem umgehen kann???

vielen dank schon mal im vorraus.

Moderiert von user profile iconMotzi: Topic Verschoben
Lemon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 96

Win XP
D5 Standart
BeitragVerfasst: Fr 02.04.04 21:06 
habe mir gedacht, dass man den editmodus der ausgewaehlten zelle irgendwie aufheben muss, damit dieser fehler nicht mehr kommt, allerdings habe ich keine ahnung wie!
ixtreme
Gast
Erhaltene Danke: 1



BeitragVerfasst: Fr 02.04.04 21:09 
zeig mal den code den du jetzt hast
Lemon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 96

Win XP
D5 Standart
BeitragVerfasst: Fr 02.04.04 21:14 
das geht net, wil der ist ziemlich lang.
mir geht's ja auch nur darum ne funktion zu finden, die eben den editmodus der zelle aufhebt.
ixtreme
Gast
Erhaltene Danke: 1



BeitragVerfasst: Fr 02.04.04 21:40 
ich verstehe dein problem nicht, man kann stringgrids auch im editmodus mit

ausblenden Delphi-Quelltext
1:
stringgrid1.free;					


löschen!

ixtreme.de
Lemon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 96

Win XP
D5 Standart
BeitragVerfasst: Sa 03.04.04 10:14 
genau das habe ich gemacht.
aber anscheinend wird da noch irgendwas ausgeloest. deshalb habe ich auch alle ereignisse auf nil gesetzt, dass die nix mehr machen, aber es geht trotzdem nicht!
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Sa 03.04.04 11:35 
Tja, aber ohne Code wird das hier höchstens ein nettes Ratespielchen..! :roll:

Du brauchst ja auch nicht den ganzen Code zu posten, sondern nur die wesentlichen Stellen..!

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Lemon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 96

Win XP
D5 Standart
BeitragVerfasst: Sa 03.04.04 12:24 
also das hier ist jetzt mal die prozedur, mit der ich alles wieder loesche.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
procedure TForm1.AlleSystemeSchliessen(Sender: TObject);
var
  i : Integer;
begin
  AlleSystemeSpeichern(Sender);
  for i := 0 to tabsheets-1 do
  begin
    stringgrids[i].OnDrawCell := nil;
    stringgrids[i].OnKeyDown := nil;
    stringgrids[i].OnKeyUp := nil;
    stringgrids[i].OnDblClick := nil;
    stringgrids[i].OnClick := nil;
    stringgrids[i].OnMouseMove := nil;
    stringgrids[i].OnTopLeftChanged := nil;
    stringgrids[i].OnSelectCell := nil;
    stringgrids[i].OnExit := nil;
  end;
  PageControl1.ActivePageIndex := 0;
  for i := 0 to tabsheets-1 do
  begin
    stringgrids[i].Free;
    alletabsheets[i].Free;
  end;
end;


vielleicht hilft das ja weiter
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Sa 03.04.04 13:25 
Also das mit den Ereignissen kannst du dir eigentlich sparen... zeig mal den Code wie du die Stringgrids erzeugst..

gibt es noch andere Stellen in denen du auf die Stringgrids zugreifst (außer den Eregnissen)...?

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Lemon Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 96

Win XP
D5 Standart
BeitragVerfasst: Sa 03.04.04 13:49 
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
  inc(tabsheets);
  setLength(alletabsheets,tabsheets);
  alletabsheets[tabsheets-1] := TTabSheet.Create(PageControl1);
  alletabsheets[tabsheets-1].PageControl := PageControl1;
  alletabsheets[tabsheets-1].Name := 'tabsheet' + IntToStr(tabsheets);
  alletabsheets[tabsheets-1].Parent := PageControl1;
  alletabsheets[tabsheets-1].Caption := 'System' + IntToStr(tabsheets);
  alletabsheets[tabsheets-1].Visible := True;

  setLength(stringgrids,tabsheets);
  stringgrids[tabsheets-1] := TStringGrid.Create(FindComponent('TabSheet' + IntToStr(tabsheets)));
  stringgrids[tabsheets-1].Name := 'StringGrid'+IntToStr(tabsheets);
  stringgrids[tabsheets-1].Parent := PageControl1.Pages[tabsheets-1];
  stringgrids[tabsheets-1].Left := 8;
  stringgrids[tabsheets-1].Top := 8;
  stringgrids[tabsheets-1].Width := 489;
  stringgrids[tabsheets-1].Height := 489;
  stringgrids[tabsheets-1].RowCount := 2;
  stringgrids[tabsheets-1].ColCount := 2;
  stringgrids[tabsheets-1].DefaultColWidth := 30;
  stringgrids[tabsheets-1].DefaultRowHeight := 30;
  stringgrids[tabsheets-1].ColWidths[0] := 100;
  stringgrids[tabsheets-1].RowHeights[0] := 100;
  stringgrids[tabsheets-1].FixedCols := 1;
  stringgrids[tabsheets-1].FixedRows := 1;
  stringgrids[tabsheets-1].Options := [goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goEditing];
  stringgrids[tabsheets-1].Font.Size := 12;
  stringgrids[tabsheets-1].Cells[1,0] := 'Spieler1';
  stringgrids[tabsheets-1].Cells[0,1] := 'Spieler1';
  stringgrids[tabsheets-1].Visible := True;
  stringgrids[tabsheets-1].PopUpMenu := PopUpMenu1;
  stringgrids[tabsheets-1].OnDrawCell := VorlageStringGrid1DrawCell;
  stringgrids[tabsheets-1].OnKeyDown := VorlageStringGrid1KeyDown;
  stringgrids[tabsheets-1].OnKeyUp := VorlageStringGrid1KeyUp;
  stringgrids[tabsheets-1].OnDblClick := VorlageStringGrid1DblClick;
  stringgrids[tabsheets-1].OnClick := VorlageStringGrid1Click;
  stringgrids[tabsheets-1].OnMouseMove := VorlageStringGrid1MouseMove;
  stringgrids[tabsheets-1].OnTopLeftChanged := VorlageStringGrid1TopLeftChanged;
  stringgrids[tabsheets-1].OnSelectCell := VorlageStringGrid1SelectCell;
  stringgrids[tabsheets-1].OnExit := VorlageStringGrid1Exit;


natuerlich gibt es noch andere stellen an denen ich auf die stringgrids zugreife. mein ganzes programm basiert auf ihnen.