Autor Beitrag
schuetzejanett
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: So 24.12.06 12:19 
Hallo,

ich möchte ein spielfeld generieren.
Für jedem spieler soll auf dem formular ein panel mit einem labelededit feld einerm button und einer pagecontrol komponente mit 2 registerkarten sein.

Die panels mit den labeledit feld und dem Button funktionieren will ich allerdings die pagecontrol komponente erzeugen wirft er eine exception

Hier der Quellcode

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:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
procedure TForm_Game.FormShow(Sender: TObject);
var i,j : integer;
const   TabTitles: array[0..1of ShortString = ('Punkte''Feld');

begin
form1.Visible := false;
form1.WindowState := wsMaximized;
if erzeugt = false then
  begin
   setlength(apanel, start.Anz);
   setlength(alabel, start.anz);
   setlength(abitbtn, start.anz);
   for i := 0 to high(apanel) do
    begin
     apanel[i] := Tpanel.Create(self);
     with apanel[i] do
      begin
        parent := self;
        Bevelouter := bvNone;
        autosize := true;
        Caption := '';
        height := 50;
        Width := 115;
        if ((i mod 2) = 0 )then left := 25 else left := 175;
        top := 85 +(100* (i div 2));
        visible := true;

      end;
     alabel[i] := TLabeledEdit.Create(self);
     with alabel[i] do
      begin
        parent := apanel[i];
        text := inttostr(aplayer[i].stand);
        height := 25;
        Width := 75;
        left := 0;
        top := 25;
        autosize := false;
        with EditLabel do
          begin
            caption := aplayer[i].name;
            height := 20;
            width  := 75;
          end;
      end;
      abitbtn[i] := TBitBtn.Create(self);
      with abitbtn[i] do
        begin

          Caption := 'P';
          height := 50;
          Width := 45;
          left := 75;
          top := 0;
        end;

      aPageControl[i] := TPageControl.Create(self); // hier kommt die Exception
      with aPageControl[i] do
        begin
          parent := apanel[i];
          for j := Low(TabTitles) to High(TabTitles) do
            with TTabSheet.Create(aPageControl[i]) do
               begin
                  PageControl := aPageControl[i];
                  Name := 'ts' + TabTitles[j];
                  Caption := TabTitles[j];
               end;
            end;
    end;
     erzeugt := true;
  end;
end;


Wäre schön wenn mir jemand helfen könnte

Frohe Weihnachten

Moderiert von user profile iconmatze: Code- durch Delphi-Tags ersetzt
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: So 24.12.06 12:23 
Wie groß hast du aPageControl dimensioniert?

_________________
Markus Kinzler.
schuetzejanett Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: So 24.12.06 12:34 
apagecotrol ist ein dynamisches Array was am anfang auf die anzahl der spieler dimensionniert wird also eine zahl zwischen 1 und 10
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 24.12.06 12:43 
Hallo,

welche Exeption wird denn geworfen?

Mein Delphi 3 hat nur Probleme mit den Setzen der Visible-Eigenschaften in OnShow. Deaktiviert man die Zeilen funktioniert es soweit.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
schuetzejanett Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: So 24.12.06 12:50 
hallo,

es ist eine exception der klasse EAccessViolation Zugriffsverletzung bei Adresse ...

Ich verwende delphi 7 , wenn das bei ber problemlösung vielleicht hilft
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 24.12.06 13:05 
Hallo,

in Deinem Code wird folgendes dimensioniert:
ausblenden Delphi-Quelltext
1:
2:
3:
   setlength(apanel, start.Anz);  
   setlength(alabel, start.anz);  
   setlength(abitbtn, start.anz);

Wo wird die Dimensionierung von aPageControl ausgeführt?

Siehe auch Bemerkung von user profile iconmkinzler

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
schuetzejanett Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 28



BeitragVerfasst: So 24.12.06 13:10 
Danke das war der Fehler.
Das hatte ich vergessen.
bin ja froh das es nur so ein kleiner fehler war.

danke dir vielmals und frohe weihnachten.