Autor Beitrag
Danny W.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 23.11.06 01:59 
Hallo,
ich habe zwei panel in die Labels geworfen werden. Das erste Label ist immer linksbündig und der rest richtet sich normal aus...was mache ich falsch?

user defined image

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
  
for i := 0 to sl.count-1 do begin                                 
 MyLabel.Parent := panel1;
 MyLabel.Caption := ts.delimitedtext;
 MyLabel.Top := 20 * x;
 MyLabel.Left := 20;
 MyLabel.Font.Color := clgreen;
 x:=x+1;
end;


mfg,
Danny

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 23.11.06 08:32 
Servus Danny!

Setz nur mal das MyLabel.Pareent:= panel1; ganz an den Schluss.

Stehen deine MyLabels in nem Array of TLabeloder wie seh ich das?
Wundert mich, dass das so funktioniert.

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 23.11.06 10:50 
das parent ans ende zu setzen hat nichts gebracht :(

@Stefan: ich mache das einfach mit

ausblenden Delphi-Quelltext
1:
MyLabel : TLabel;					


//Edit

Im ersten Post war ja nur ein kleiner Ausschnitt des Quelltextes...hier nochmal eine komplette version :)

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:
                    if db1.Connect2MysqlDB(dbhost,dbuser,dbpw,dbtable,dbport,s) then
         begin
            befehl:='SELECT buddys FROM user WHERE nick = "'+nickname.text+'"';
            ts:=tstringlist.Create;
            db1.sendcmd(befehl,false,ts);


                sl := TStringList.Create;
                sl.Delimiter := ',';
                sl.DelimitedText := ts.Text;


                  for i := 0 to sl.count-1 do
                   begin
                    MyLabel := TLabel.Create(self);


                    befehl:='SELECT nick FROM user WHERE id = "'+sl.strings[i]+'"';
                    db1.sendcmd(befehl,false,ts);

                    online := tstringlist.create;
                    befehl:='SELECT online FROM user WHERE nick = "'+ts.delimitedtext+'"';
                    db1.sendcmd(befehl,false,online);

                    if online.delimitedtext = '1' then begin
                        MyLabel.Caption := ts.delimitedtext;
                        MyLabel.Top := 20 * x;
                        MyLabel.Left := 20;
                        MyLabel.Font.Color := clgreen;
                        MyLabel.Parent := panel1;
                        x:=x+1;
                        end
                    else begin
                        MyLabel.Caption := ts.delimitedtext;
                        MyLabel.Top := 20 *y;
                        MyLabel.Left := 20;
                        MyLabel.Font.Color := clred;
                        MyLabel.Parent := panel2;
                        y:=y+1;
                        end;

                   end;
              db1.DisConnectMysqlDB(s);
            ts.free;
          online.free;
         sl.free;
        mylabel.free;
         end
      else showmessage('Datenbankverbindung unterbrochen!');

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"


Zuletzt bearbeitet von Danny W. am Do 23.11.06 10:56, insgesamt 1-mal bearbeitet
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 23.11.06 10:53 
hmm..
du könntest beim label autosize auf false stellen
das label so breit machen wie das panel ist
und rechtsausrichten lassen...

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 23.11.06 11:03 
ich will ja aber das zweite panel direkt unters erste machen..das funktinioert nur wenn ich abfrage wie groß das erste ist...wenn das statisch ist, bringt mir das ja nicht viel :/

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 23.11.06 11:09 
wenns die panels statisch sind geht das genauso

ausblenden Delphi-Quelltext
1:
2:
3:
..
panel2.width:= panel1.width;
...


LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 23.11.06 11:59 
ja ich weiß :) Aber die Länge der Namen und die Anzahl sind ja variabel

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 23.11.06 12:04 
ja und?
trotzdem kannst du doch dem label die breite des parents (panels) geben

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.
Danny W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 296

Windows XP, WIN 2000
Delphi 2005 PE
BeitragVerfasst: Do 23.11.06 14:12 
okay, aber wie regel ich das mit der höhe des panels? immer so hoch wie es namen beinhaltet?

mfG,
Danny

_________________
"Ich find den Fehler nicht. Der Artist wird immer als "Syntax Error" gezeigt :("
"Ach verdammt, der Artist heißt wirklich "Syntax Error" xD"
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Do 23.11.06 14:47 
richtig =)
kannst du auch so lösen, dass immer wenn du n namen hinzufügst panel.heigh:= panel.height + x; mitsetzt.

LG
Stefan

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.