Autor Beitrag
pmw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 65



BeitragVerfasst: Di 13.08.02 12:10 
Hallo!

Warum werden die erzeugten Komponenten MyPages, MyBevel, ButtonBack, ButtonNext und ButtonClose nicht angezeit? Was mache ich falsch?

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:
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:
unit Wizard;

interface

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


type
     [ ... ]
of object;
  TWizard = class(TCustomPanel)
  private
     [ ... ]
  protected
     [ ... ]
  public
     constructor Create(AOwner: TComponent); override;
     [ ... ]
     procedure ChangeButtons;
  published
     property Enabled;
     property Visible;
     property Align;
     property ShowHint;
     [ ... ]
  end;

procedure Register;

implementation

Constructor TWizard.Create(AOwner: TComponent);
var
Button: TButton;
Notebook: TNotebook;
Bevel: TBevel;
begin

   inherited;

   FTextNext := '&Next >';
   FTextBack := '< &Back';
   FTextCancel := '&Cancel';
   FTextFinish := '&Finish';

   Width := 337;
   Height := 209;
   BorderWidth := 0;

   Notebook := TNotebook.Create(self);
   Notebook.Height := 160;
   Notebook.Align := alTop;
   Notebook.Pages.Strings[0] := '0';
   Notebook.Color := clWhite;
   Notebook.Parent := TWizard(FindComponent(Name));
   Notebook.Name := 'MyPages';

   Bevel := TBevel.Create(self);
   Bevel.Top := 161;
   Bevel.Left := 0;
   Bevel.Height := 17;
   Bevel.Shape := bsTopLine;
   Bevel.Anchors := [akLeft,akRight,akBottom];
   Bevel.Parent := TWizard(FindComponent(Name));
   Bevel.Name := 'MyBevel';

   Button := TButton.Create(self);
   Button.Top := 171;
   Button.Left := 16;
   Button.Height := 25;
   Button.Width := 83;
   Button.Anchors := [akRight,akBottom];
   Button.Name := 'ButtonBack';

   Button := TButton.Create(self);
   Button.Top := 171;
   Button.Left := 128;
   Button.Height := 25;
   Button.Width := 83;
   Button.Anchors := [akRight,akBottom];
   Button.Name := 'ButtonNext';

   Button := TButton.Create(self);
   Button.Top := 171;
   Button.Left := 240;
   Button.Height := 25;
   Button.Width := 83;
   Button.Anchors := [akRight,akBottom];
   Button.Name := 'ButtonClose';

   ChangeButtons;

end;

[ ... ]

end.
knightkiller
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 35

WinXP SP2
D7 Pers, D2005 Pers
BeitragVerfasst: Di 13.08.02 12:16 
ich würde es mal mit Komponente.visible:=true versuchen :wink:
pmw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 65



BeitragVerfasst: Di 13.08.02 12:19 
Hallo!

Da liegt nicht das Problem. Wenn ich z.B. Notebook.Parent := TWinControl(AOwner); benutze habe ich die Notebookkomponete auf dem Form sitzen. Mein Problem ist, die Notebookkomponete auf TWizard zu bekommen.

Viele Grüße
Martin Winandy
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Di 13.08.02 12:51 
Hallo,

Du musst beim erstellen der Visuellen Kompoenten auch den Parent angeben!
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
Notebook := TNotebook.Create(self);
Notebook.Parent := Self;
{...}
Bevel := TBevel.Create(self);
Bevel.Parent := Self;
{...}


Gruß
TINO
Renegade
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 358

Win XP Pro, Win 7 Beta
BDS 2006
BeitragVerfasst: Di 13.08.02 12:53 
Moin erstmal!

First at all mußt du allen Kompos einen Parent zuweisen.

Desweiteren glaube ich nicht, daß
Zitat:
ausblenden Quelltext
1:
Button.Name := 'ButtonBack'					
funktionieren wird. Du mußt stattdessen mehrere Kompos (in diesem Beispiel Buttons) der Marke "fButtonBack", "fButtonNext" ... erstellen.

Hoffe das hilft dir.

Wenn noch fragen sind -> posten! :D

Gruß Renegade

_________________
Sokrates (468 v.Chr. - 399 v.Chr.)
"Es ist keine Schande, nichts zu wissen, wohl aber, nichts lernen zu wollen."