Autor Beitrag
DP
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Di 30.05.06 14:55 
Hi, ich hoffe mal, dass mein Beitrag hier richtig ist ;)
Aber nun mal zum eigentlich Thema: Ich bin dabei für ein Schulprojekt ein Würfelprogramm zu programmieren, dass an sich nicht weiter schwierig sein sollte, nur bekomme ich, wenn ich das Projekt kompilieren will, die FehlermeldungProject <<raised exception class 'External: SIGSEGV'>> Ich muss zwar zugeben, dass ich nicht mit Delphi, sondern mit Pascal gearbeitet habe, aber die beiden sind sich ja recht ähnlich und vielleicht kann mir ja trotzdem einer weiterhelfen... schonmal vielen Dank im Voraus :)
starsurfer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Di 30.05.06 15:10 
Mhhhh, meine Glaskugel spuckt nur verschwommene Bilder aus. Wenn man die mit etwas Code füttern könnte würde das vll. klarer werden.

_________________
GEIZ IST GEIL! - Ihr Sozialamt
DP Threadstarter
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Di 30.05.06 15:16 
Dann will ich der Kristallkugel mal helfen ;)
unit Unit1;

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:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  Buttons;

type

  TWuerfel = class
   W: ARRAY[1..7] OF TPanel;
   auz: integer;
   Farbe: TColor;
   procedure erg1;
   procedure erg2;
   procedure erg3;
   procedure erg4;
   procedure erg5;
   procedure erg6;
  end;
   

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Panel1: TPanel;
    Panel10: TPanel;
    Panel11: TPanel;
    Panel12: TPanel;
    Panel13: TPanel;
    Panel14: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    Panel4: TPanel;
    Panel5: TPanel;
    Panel6: TPanel;
    Panel7: TPanel;
    Panel8: TPanel;
    Panel9: TPanel;
    procedure FormCreate(Sender: TObject);
  private
  public
    { public declarations }
  end; 

var
  Form1: TForm1; 
  az1,az2,pasch: integer;
  W1,W2: TWuerfel;
implementation

{ TForm1 }


procedure TForm1.FormCreate(Sender: TObject);
begin
  W1.W[1]:= Panel1;
  W1.W[2]:= Panel2;
  W1.W[3]:= Panel3;
  W1.W[4]:= Panel4;
  W1.W[5]:= Panel5;
  W1.W[6]:= Panel6;
  W1.W[7]:= Panel7;
  
  W2.W[1]:= Panel8;
  W2.W[2]:= Panel9;
  W2.W[3]:= Panel10;
  W2.W[4]:= Panel11;
  W2.W[5]:= Panel12;
  W2.W[6]:= Panel13;
  W2.W[7]:= Panel14;

  W1.Farbe:= clgreen;
  W2.Farbe:= cllime;
end;

procedure TWuerfel.erg1;
  begin
   W[4].color:= Farbe;
end;

procedure TWuerfel.erg2;
 begin
  W[3].color:= Farbe;
  W[5].color:= Farbe;
end;

procedure TWuerfel.erg3;
  begin
   W[4].color:= Farbe;
   erg2;
end;

procedure TWuerfel.erg4;
  begin
   erg2;
   W[1].color:= Farbe;
   W[7].color:= Farbe;
end;

procedure TWuerfel.erg5;
  begin
   erg4;
   erg1;
end;

procedure TWuerfel.erg6;
  begin
   erg4;
   W[2].color:= Farbe;
   W[6].color:= Farbe;
end;

initialization
  {$I unit1.lrs}

end.


Das ist eben die komplette Unit1 und damit das Projekt

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 30.05.06 15:27 
Muss man nicht vorher den constructor der Klasse TWuerfel aufrufen?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
DP Threadstarter
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Di 30.05.06 15:33 
Ich geb ehrlich zu, bisher hab ich mich nicht so sehr mit Pascal etc beschäftigt ;) Von daher: Was ist der Constructor?
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 30.05.06 15:36 
user profile iconDP hat folgendes geschrieben:
Ich geb ehrlich zu, bisher hab ich mich nicht so sehr mit Pascal etc beschäftigt ;) Von daher: Was ist der Constructor?

ausblenden Delphi-Quelltext
1:
2:
W1:=TWuerfel.create;
W2:=TWuerfel.create;

Der constructor (.create) erzeugt erst die beiden Instanzen W1 und W2 der Klasse TWuerfel.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
DP Threadstarter
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Di 30.05.06 15:38 
Und wo würde das dann hingehören? So ähnlich wie TForm1.create als Prozedur?
DP Threadstarter
Hält's aus hier
Beiträge: 13



BeitragVerfasst: Di 30.05.06 15:40 
Vielen Dank, hab's jetzt unter TForm1.create stehen, das Projekt startet jetzt! Vielen, vielen Dank, jetzt kann ich weitermachen *freu* :)
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 30.05.06 15:40 
Nein, am besten ins OnCreate-Ereignis des Hauptformulars.
Edit: Hast es ja schon selber hinbekommen ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot