Autor Beitrag
Jakane
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 257



BeitragVerfasst: Fr 10.05.13 10:06 
Hallo liebe Delphi-Helfer :)

meine Panels sind nicht dazu da Texte wieder zu geben:

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

interface

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

type
  TJPanel = class(TCustomPanel)
  private
    { Private-Deklarationen }
  protected
    { Protected-Deklarationen }
  public
    { Wärend der Programmierung auswählbare Funktionen }
    constructor Create(AOwner: TComponent); override;
  published
    { Objekteingenschaften }
    property Cursor;
    property Hint;
    property Left;
    property Name;
    property Tag;
    property Top;
    property Visible;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Jakane', [TJPanel]);
end;

constructor TJPanel.Create(AOwner: TComponent);
begin
  inherited;
  Text:= '';
end;

end.


Wenn ich aber die Komponente auf mein Formular lege ist der Text immernoch da :(
Wenn ich das Programm starte ist es weg, aber ich will, das es auch weg ist wenn ichs aufs Formular lege

Wie mach ich das? :)

Danke
Tranx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 648
Erhaltene Danke: 85

WIN 2000, WIN XP
D5 Prof
BeitragVerfasst: Fr 10.05.13 10:33 
Wundere mich, dass das funktioniert:

Die Eigenschaft, die den Text ausgibt ist nämlich bei TPanel Caption!!

Also schreibe doch statt Text := '', Caption := '', vielleicht geht das.

_________________
Toleranz ist eine Grundvoraussetzung für das Leben.
Jakane Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 257



BeitragVerfasst: Fr 10.05.13 10:41 
Nein geht auch nicht.
Das Create springt nur beim Prorgammstart an, aber nicht wenn ich die Komponente aufs Formular leg
Tranx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 648
Erhaltene Danke: 85

WIN 2000, WIN XP
D5 Prof
BeitragVerfasst: Fr 10.05.13 10:57 
Vielleicht versuchst Du es mit der Methode Repaint:



ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
// in der Klasse:

  Procedure Repaint; override;






// Definition:

   procedure TPanel.Repaint;
   begin
     Caption := '';
     Inherited;
   end;

_________________
Toleranz ist eine Grundvoraussetzung für das Leben.
Jakane Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 257



BeitragVerfasst: Fr 10.05.13 11:17 
nein, ist immernoch da :(
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 10.05.13 11:30 
Folgender Code funktioniert bei mir (DELPHI 2009):

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

interface

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


type
  TForm1 = class(TForm)
    Panel1: TPanel;
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;
//-------------------------------------------------
type
  TJPanel = class(TCustomPanel)
  private
    { Private-Deklarationen }
  protected
    { Protected-Deklarationen }
  public
    { Wärend der Programmierung auswählbare Funktionen }
    constructor Create(AOwner: TComponent); override;
  published
    { Objekteingenschaften }
    property Caption;
    property Cursor;
    property Hint;
    property Left;
    property Name;
    property Tag;
    property Top;
    property Visible;
  end;

var
  Form1: TForm1;
  Panel2: TJPanel;

//procedure Register;


implementation

{$R *.dfm}
(*
procedure Register;
begin
  RegisterComponents('Jakane', [TJPanel]);
end;
*)


constructor TJPanel.Create(AOwner: TComponent);
begin
  inherited;
  left:=50;
  Top:=50;
  Height:=100;
  Width:=100;
  Color:=clRed;
  Caption:='';
  Visible:=true;
  Enabled:=true;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
Panel2 := TJPanel.Create(self);
Panel2.Parent := Self;
end;

end.


Zuletzt bearbeitet von hathor am Fr 10.05.13 13:09, insgesamt 2-mal bearbeitet
Jakane Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 257



BeitragVerfasst: Fr 10.05.13 11:34 
ok
das probier ich aus wenn niemand anderen was einfällt ^^ TForm wollte ich nicht unbedingt drin haben
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Fr 10.05.13 13:01 
TForm kommt doch nur aus dem Beispiel-Projekt, damit das überprüft werden kann. Das hat nichts mit der Komponente zu tun.
Bei mir funktioniert das auch, wenn ich Caption einen Leer-String zuweise. Alternativ kannst du auch die Eigenschaft ShowCaption auf False setzen.

Ich habe beides bei mir getestet. Wenn es bei dir nicht funktioniert, bindest du evtl. die falschen/veralteten Units ein. Prüfe mal deine Verzeichnisse und schmeiße alle *.dcu raus, die mit der Kompenente zu tun haben.
WasWeißDennIch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 653
Erhaltene Danke: 160



BeitragVerfasst: Sa 11.05.13 16:27 
Vielleicht noch csSetCaption aus ControlStyle entfernen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
constructor TJPanel.Create(AOwner: TComponent);
begin
  inherited;
  ...
  ControlStyle := ControlStyle - [csSetCaption];
end;

Für diesen Beitrag haben gedankt: Jakane
Jakane Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 257



BeitragVerfasst: Mo 13.05.13 11:56 
user profile iconWasWeißDennIch hat folgendes geschrieben Zum zitierten Posting springen:
Vielleicht noch csSetCaption aus ControlStyle entfernen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
constructor TJPanel.Create(AOwner: TComponent);
begin
  inherited;
  ...
  ControlStyle := ControlStyle - [csSetCaption];
end;


sowas hab ich mir gewünscht danke :D