Autor Beitrag
BlackRaven
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Mi 01.12.04 15:07 
Ich hab in einer form verschiedene frames, die ich während der laufzeit erstelle, hab aber schon ein label, zwei bevels und vier Buttons.
Ich poste mal den ganzen code:
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:
object fststart: Tfststart 
  Left = 256 
  Top = 164 
  Width = 390 
  Height = 332 
  Caption = 'fststart' 
  Color = clBtnFace 
  Font.Charset = DEFAULT_CHARSET 
  Font.Color = clWindowText 
  Font.Height = -11 
  Font.Name = 'MS Sans Serif' 
  Font.Style = [] 
  OldCreateOrder = False 
  OnClose = FormClose 
  OnCreate = FormCreate 
  PixelsPerInch = 96 
  TextHeight = 13 
  object Bevel1: TBevel 
    Left = 6 
    Top = 30 
    Width = 369 
    Height = 2 
  end 
  object Bevel2: TBevel 
    Left = 4 
    Top = 265 
    Width = 369 
    Height = 2 
  end 
  object Label2: TLabel 
    Left = 96 
    Top = 4 
    Width = 286 
    Height = 24 
    Caption = 'WebCamControlZenter - First Start' 
    Font.Charset = DEFAULT_CHARSET 
    Font.Color = clWindowText 
    Font.Height = -19 
    Font.Name = 'MS Sans Serif' 
    Font.Style = [] 
    ParentFont = False 
  end 
  object Button1: TButton 
    Left = 224 
    Top = 272 
    Width = 75 
    Height = 25 
    Caption = 'Weiter' 
    TabOrder = 0 
    OnClick = Button1Click 
  end 
  object Button2: TButton 
    Left = 144 
    Top = 272 
    Width = 75 
    Height = 25 
    Caption = 'Zurück' 
    Enabled = False 
    TabOrder = 1 
    OnClick = Button2Click 
  end 
  object Button3: TButton 
    Left = 304 
    Top = 272 
    Width = 75 
    Height = 25 
    Caption = 'Fertig Stellen' 
    Enabled = False 
    TabOrder = 2 
  end 
  object Button4: TButton 
    Left = 64 
    Top = 272 
    Width = 75 
    Height = 25 
    Caption = 'Abbrechen' 
    TabOrder = 3 
    OnClick = Button4Click 
  end 
end


soweit die komponenten
nun der eigentliche code:

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:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
unit Unit3; 

interface 

uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls, ExtCtrls, Unit4; 

type 
  Tfststart = class(TForm) 
    Bevel1: TBevel; 
    Button1: TButton; 
    Button2: TButton; 
    Button3: TButton; 
    Button4: TButton; 
    Bevel2: TBevel; 
    Label2: TLabel; 
    procedure Button4Click(Sender: TObject); 
    procedure FormClose(Sender: TObject; var Action: TCloseAction); 
    procedure FormCreate(Sender: TObject); 
    procedure startframe; 
    procedure userframe; 
    procedure Button1Click(Sender: TObject); 
    procedure Button2Click(Sender: TObject); 
  private 
    { Private-Deklarationen } 
  public 
    { Public-Deklarationen } 
  end; 

var 
  fststart: Tfststart; 
  count: Integer; 
  frm_start, frm_user: TFrame; 

implementation 

uses Unit1; 

{$R *.dfm} 

procedure Tfststart.Button4Click(Sender: TObject); 
begin 
Form1.close; 
end; 

procedure Tfststart.FormClose(Sender: TObject; var Action: TCloseAction); 
begin 
form1.Close; 
end; 

procedure Tfststart.FormCreate(Sender: TObject); 
begin 
count := 0; 
startframe; 
end; 

procedure Tfststart.startframe; 
var 
  frm_lbl1, frm_lbl2: TLabel; 
begin 
//----Komponenten definieren----// 
//----Frame1----// 
frm_start := TFrame.Create(fststart); 
frm_start.Parent := self; 
//----Label1----// 
frm_lbl1 := TLabel.Create(frm_start); 
frm_lbl1.Parent := frm_start; 
//----Label2----// 
frm_lbl2 := TLabel.Create(frm_start); 
frm_lbl2.Parent := frm_start; 
//----Komponenten einen Wert zuweisen----// 
//----Frame1----// 
frm_start.Top := 40; 
frm_start.Left := 10; 
frm_start.Width := fststart.Width - 20; 
frm_start.Height := 100; 
//----Label1----// 
frm_lbl1.Caption := 'Herzlich Willkommen beim FirstStart'#10#13+'Assistent'; 
frm_lbl1.Font.Size := 14; 
frm_lbl1.Alignment :=taCenter; 
frm_lbl1.Left := 25; 
//----Label2----// 
frm_lbl2.Caption := 'Hier stellen Sie Ihre Daten wie Benutzername ect. ein.'#10#13'Diese können Sie später jederzeit wieder ändern'; 
frm_lbl2.Top := frm_lbl1.Top + frm_lbl1.Height + 2; 
end; 

procedure Tfststart.userframe; 
var 
  lbl_user, lbl_pw, frm_lbl1: TLabel; 
  edit_user, edit_pw : TEdit; 
  user_box: TGroupBox; 
begin 
      //----Komponenten erstellen----// 
      //----Frame----// 
      frm_user := TFrame.Create(self); 
      frm_user.Parent := self; 
      //----GroupBox----// 
      user_box := TGroupBox.Create(frm_user); 
      user_box.Parent := frm_user; 
      //----Username Label 
      lbl_user := Tlabel.Create(frm_user); 
      lbl_user.Parent := frm_user; 
      //----Passwort Label----// 
      lbl_pw := Tlabel.Create(frm_user); 
      lbl_pw.Parent := frm_user; 
      //----Label1----// 
      //frm_lbl1 := Tlabel.Create(frm_user); 
      //frm_lbl1.Parent := frm_user; 
      //----Komponenten definieren----// 
      //----frame----// 
      frm_user.Top := 40; 
      frm_user.Left := 10; 
      frm_user.Width := fststart.Width - 20; 
      frm_user.Height := 100; 
      //----GroupBox----// 
      user_box.Caption := 'Benutzerdaten'; 
end; 

procedure Tfststart.Button1Click(Sender: TObject); 
begin 
count := count + 1; 
ShowMessage(IntToStr(count)); 
  case count of 
    1: begin 
      frm_start.Free; 
      userframe; 
      end; 
  end; 

if count > 0 then Button2.Enabled := True; 
end; 

procedure Tfststart.Button2Click(Sender: TObject); 
begin 
count := count - 1; 

  case count of 
    0: begin 
        startframe; 
      end; 
  end; 
if count = 0 then Button2.Enabled := False; 
end; 

end.


Der fehler tritt in der procedure Tfststart.userframe auf, das label2 sich selber dupliziert und im frame mit der groupbox wieder auftaucht.

Hab keine idee wie das passiert.

So siehts aus:
blackraven.bl.funpic.de/dplbl/
herzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 168

WINXP pro, SUSE Linux 9.0
D7 Pers.
BeitragVerfasst: Do 02.12.04 22:00 
Hast du mal nur das Label anzeigen lassen?

Würd das problem mal schritt für Schritt analysieren!
BlackRaven Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 04.12.04 10:17 
Das hab ich schon gemacht. Es muss mit der GroupBox zu tun haben, wenn ich diese Ausblende, dupliziert sich das Label nicht.

Ich hab üprigens andere gebeten (2) das Programm mal bei sich laufen zu lassen und bei der einen Person duplizierte es sich nicht und bei der anderen auch.
herzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 168

WINXP pro, SUSE Linux 9.0
D7 Pers.
BeitragVerfasst: Sa 04.12.04 11:06 
Kannst du mir das Programm mal geben ? dann kann ich auch mal testen !

Am besten mit Quellcode.
BlackRaven Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Sa 04.12.04 20:43 
Der Source den du oben findest ist das komplette Programm ;) bzw, der teil, kann aber als eigenständiger code genutzt werden.