Autor Beitrag
Phanuel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36

Win XP Pro, Mandrake linux 10.0

BeitragVerfasst: Mi 10.11.04 21:07 
Hallo ich hab einige Panels, mit hilfe von diesem Quelltext erstellt:

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:
25:
26:
27:
28:
iTop:=0;
iLEft:=0;
Randomize;
for i:= 1 to 108 do
begin
SB:=TPanel.create(Form1); //Ein Panel wird mithilfe der Objektvariable SB erstellt
icolor:=RandomRange(1,4); 
case icolor of
1:SB.color:=clred;
2:SB.color:=clyellow;
3:SB.color:=clblue;
end;

SB.Name:='SB'+inttostr(i); //Der Name wird festgelegt
SB.CAption:='';
SB.Height:=22;
SB.Width:=22;
SB.Left:=iLEft;
Sb.Top:=itop;
SB.Parent:=Form1; //Parent ist Form1
if iLeft > 154 then
begin
iTop:=iTop+22;
iLeft:=-22;
end;
iLeft:=iLeft+22;
end;
end;


Der Unkommentierte Rest tut es nicht zur Sache.

Nun frage ich mich aber wie kann ich Prozeduren schreiben, die aktiviert werden wenn ich auf ein Panel klicke, zb das es selber unsichtbar wird.

Halt sowas in der Art:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.SB1Click(Sender: TObject);
begin
Sb,visible:=false;
end;



Vielen Dank im Vorraus

Sebastian Bittmann

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


Zuletzt bearbeitet von Phanuel am Do 11.11.04 12:44, insgesamt 2-mal bearbeitet
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Mi 10.11.04 21:19 
probiers mal mit
SB.OnClick := SB1Click;wobei SB1Click dann die Prozedur ist ;)


MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
Phanuel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36

Win XP Pro, Mandrake linux 10.0

BeitragVerfasst: Mi 10.11.04 22:28 
Funktioniert bei mir nicht,
hab das einfach mal unter Formcreate eingebaut, und es klappt 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: Mi 10.11.04 22:52 
Phanuel hat folgendes geschrieben:
Funktioniert bei mir nicht

Gehts vielleicht ein bisschen genauer als nur "funktioniert nicht"..? :roll: ;)

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

Win XP Pro, Mandrake linux 10.0

BeitragVerfasst: Do 11.11.04 11:46 
Motzi hat folgendes geschrieben:
Phanuel hat folgendes geschrieben:
Funktioniert bei mir nicht

Gehts vielleicht ein bisschen genauer als nur "funktioniert nicht"..? :roll: ;)


Ja ich habe es unter formcreate eingebaut,
die Prozedur ist drin und es funktioniert 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: Do 11.11.04 11:50 
Hmpf.. eine etwas genauere Beschreibung _was_ nicht funktioniert wäre durchaus hilfreich..! :?

Wie schaut dein Code aus, was für eine Fehlermeldung erhältst du, ... ein bisschen mehr Infos bitte! :)

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

Win XP Pro, Mandrake linux 10.0

BeitragVerfasst: Do 11.11.04 12:27 
Schau einfach da siehst du den quelltext.
ich bekomme keine fehlermeldung nur wenn ich auf das Panel drücke dann passiert nichts!

Vielleicht sollte ich meine Frage umformulieren.
Wie erstelle ich Ereigniss methoden, für selbsterstellte Klassen?
Udontknow
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2596

Win7
D2006 WIN32, .NET (C#)
BeitragVerfasst: Do 11.11.04 12:34 
Hallo!

Du musst den Sender benutzen, um festzustellen, welches Panel denn geklickt wurde.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.SB1Click(Sender: TObject);
begin
  TPanel(Sender).visible:=false;
end;


Cu,
Udontknow
Phanuel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36

Win XP Pro, Mandrake linux 10.0

BeitragVerfasst: Do 11.11.04 12:46 
habs schon selber rausgefunden trotzdem danke