Autor Beitrag
Ice
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Do 20.02.03 11:40 
Tachchen,

ist es möglich eine ScrollBox als Parent anzugeben? mit folgendem Quelltext:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
function SetKomp(zaehl,breite,tiefe,hoehe,stock:integer;name:String;Box:TScrollBox):boolean;
var
 i : shortint;
begin
 for i := 1 to zaehl do
  begin
   Komp := TKomponente.Create(Box);
   Komp.OnMouseDown := OnMouseDownH;
   Komp.OnMouseMove := MouseMoveH;
   Komp.OnMouseUp   := MouseUpH;
   Komp.OnClick := OnClickH;
   Komp.Parent:=Box;
   Komp.Name := name +inttostr(i);
   Komp.caption := name + inttostr(i);
   Komp.Left := 10;
   Komp.Top := 10+10*i;
   Komp.Raumbreite := breite;
   Komp.Raumlaenge := tiefe;
   Komp.Raumhoehe  := hoehe;
   Komp.Show;
  end;
 result := true;

erscheint bei mir die Meldung :
Zitat:
inkompatible typen TWinControl und TScrollBox

mache ich das ganze aber mit einer GroupBox funktioniert es. Ist die ScrollBox dafür nicht geeignet?

Vielen Dank im voraus.

mfg
Ice

Moderiert von user profile iconTino: Code- & Quote-Tags hinzugefügt.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 20.02.03 11:54 
Hallo
ausblenden Quelltext
1:
Komp := TKomponente.Create(Form1);					


Kennst du With?
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
Komp := TKomponente.Create(Box); 
with Komp do
  begin
    OnMouseDown := OnMouseDownH; 
    OnMouseMove := MouseMoveH; 
    OnMouseUp := MouseUpH; 
    ...
  end;


Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Ice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Do 20.02.03 11:57 
8) Ja kenne ich ändert aber meiner Meinung nach nichts an der Fehlermeldung

mfg
Ice
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 20.02.03 12:10 
Zitat:
Ja kenne ich ändert aber meiner Meinung nach nichts an der Fehlermeldung

hehe, aufwachen ! munter werden! :wink:

alles lesen:
ausblenden Quelltext
1:
Komp := TKomponente.Create(Form1);					

Form, nicht Box

mfg Frank

Moderiert von user profile iconTino: Code- & Quote-Tags hinzugefügt.

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Ice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Do 20.02.03 12:22 
:oops: Sorry hatte ich überlesen....
ändert aber nichts daran nur das jetzt anstatt TScrollBox TForm in der Fehlermeldung steht.... :(
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 20.02.03 13:16 
ok, hast recht - dein Fehler liegt woanders.
hab nochmal kurz probiert, sogar wenn du Scrollbox als owner angibst, geht es, muß an TKomponente liegen.

was ist TKomponente? eine eigene Komponente?
poste mal deinen Constructor!


Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Ice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Do 20.02.03 13:42 
Ja ist eine eigene Komponente die von TPanel abgeleitet ist:
ausblenden volle Höhe 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:
constructor TWürfel.Create(AOwner:TComponent);
begin
 inherited Create(AOwner);
  width := 100;
  height:= 100;
  //color := clWhite;
  caption := '';
  Wand1 := TPanel.Create (self);
  with Wand1 do
     begin
      Parent := self;
      Caption := '';
      Height := 3;
      Width := 100;
      color := clBlack;
     end;
  Wand2 := TPanel.Create(self);
  with Wand2 do
    begin
      Parent := self;
      Caption := '';
      Height := 100;
      Width := 3;
      color := clBlack;
    end;
  Wand3 := TPanel.Create(self);
  with Wand3 do
    begin
      Parent := self;
      Caption := '';
      Height := 3;
      Width := 100;
      Top := 97;
      color := clBlack;
    end;
  Wand4 := TPanel.Create(self);
  with Wand4 do
    begin
      Parent := self;
      Caption := '';
      Height := 100;
      Width := 3;
      Left := 97;
      color := clBlack;
    end;
end;

destructor TWürfel.Destroy;
begin
 inherited Destroy;
 Wand1.Free;
 Wand2.Free;
 Wand3.Free;
 Wand4.Free;
end;


Moderiert von user profile iconTino: Code-Tags hinzugefügt.
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 20.02.03 14:00 
Ice hat folgendes geschrieben:

constructor TWürfel.Create(AOwner:TComponent);

den rest habe ich mir gleich garnicht angeschaut.
und das kannst du übersetzen? Klassen oder Variablen namen können kein 'ü' enthalten ....

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Ice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Do 20.02.03 14:22 
Ja habe ich aus dem kopf geschrieben da ich den Quellcode nicht da habe, im Original ist das genauso nur Würfel mit ue.

mfg
Ice