Autor Beitrag
FriFra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Do 09.10.03 09:56 
Ich komme irgendwie nicht wirklich weiter...

Damit mal jemand nachsehen kann, was ich falsch mache, habe ich ein TestProjekt attached, welches die Komponente TFr_Test unter "FriFra-Test" installiert.

Download...

Die Komponente ist nur ein Test und hat auch nur eine Eigenschaft ;) und den About-Dialog. Allerdings gibt es die bekannten Probleme mir der nicht vorhandenen "Proxies.dcu" beim Versuch ein Programm zu compilieren, welches diese Komponente verwendet :?

Den About Dialog brauche ich wirklich nur zur Designzeit, allerdings bin ich eben etwas Ratlos, wie ich das Delphi "beibringe"... :roll:

_________________
Michael
(principal certified lotus professional - developer)
maximus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 896

Win XP, Suse 8.1
Delphi 4/7/8 alles prof
BeitragVerfasst: Do 09.10.03 10:31 
Zitat:
Den About Dialog brauche ich wirklich nur zur Designzeit, allerdings bin ich eben etwas Ratlos, wie ich das Delphi "beibringe"...


Du kannst mit der eigenschaft 'componentState' den status der kompo abfragen...wen 'csDesigning' drinne ist befindet sich die kompo im design-modus:
ausblenden Delphi-Quelltext
1:
 if csDesigning in componentState then showAboutDlg;					


mfg

_________________
mfg.
mâximôv
FriFra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Do 09.10.03 10:44 
Das hilft mir leider nicht weiter, da ich kein Projekt mit dieser Komponente compilieren kann, weil man die units "DesignIntf" und "DesignEditors" nur zur Designzeit verwenden darf... und eine <ironie>dynamische Bindung von units ist mir nicht bekannt</ironie> ;)
Irgendwie muss ich das Projekt in ein Designtime- und Runtime-Package aufteilen... aber wie, das ist die Frage (schau Dir doch mal die Source an ;) )

_________________
Michael
(principal certified lotus professional - developer)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Do 09.10.03 12:32 
Hallo,

diese Frage habe ich in einem anderen Zusammenhang schon einmal beantwortet: www.delphi-forum.de/...=6766&highlight=

Falls das nicht helfen sollte, die Vorgehensweise noch einmal in Kurzform:

a) Alle Property-Editoren haben in der Unit der einzelnen Komponenten nichts zu suchen und gehören in eine eigene Unit!

b) Alle Register-Anweisungen haben auch nichts in den Units der Komponenten zu suchen, sondern gehören ebenfalls in eine eigene Unit.

c) Für die unter b) genannte eigene Unit würde ich sinnigerweise register.pas vorschlagen.

d) In der Unit register.pas werden alle RegisterComponents- und alle RegisterPropertyEditor-Anweisungen zusammengefasst. Natürlich müssen in der uses-Klausel alle betroffenen Komponentenunits aufgenommen werden.
Zusätzlich muss noch folgendes in der Uses-Klausel erscheinen:

bei D5: DsgnIntf
bei (D6), D7: DesignIntf

e) für die unter a) genannte Property-Unit gehören noch in die uses-Klausel:
bei D5: DsgnIntf
bei (D6), D7: DesignIntf, DesignEditors

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
FriFra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Do 09.10.03 12:43 
Aber wie lege ich dan die Property "About" in meiner Komponente an? Wenn ich das so mache, wie Du es schreibst, kann ich "About" (Aufruf des Dialoges) nur in der register.pas als Property anlegen... aber den Komponenten fehlt dann das "About"... oder hab ich da noch was übersehen?

_________________
Michael
(principal certified lotus professional - developer)
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Do 09.10.03 14:34 
Hallo,

Deine Komponente hat wahrscheinlich ein Property Namens "About"?

Dieses musst/kannst Du dann folgendermaßen deklarieren:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
type
  TMyKompo=class(...)
  private
    ...
    ...
    fAbout:String;
  published
    ...
    ...
    property About:String read fAbout write fAbout;
    ...
  end; // TMyKompo


In der Unit, in der Du die PropertyEditoren abgelegt hast, musst/kannst Du dann folgendermaßen vorgehen:

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:
// -------------------------- TAboutProperty --------------------------------

unit MyPropertyEditors;

interface

uses
  Windows, Forms,
  DesignInf, DesignEditors,
  ...., 
  MyAboutForm;


  TAboutProperty=class(TStringProperty)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
    procedure SetValue(const aVal: string); override;
  end; // TAboutProperty


implementation

resourcestring
  ilFMTVERSION= 'Version %s';
  ilVERSION     ='1.0.0.0 für Delphi 7';

procedure TAboutProperty.Edit;
begin
  with TMyAboutForm.Create(Application) do
  try
    ShowModal;
  finally
    Free;
  end; // tra, with 
end; // TAboutProperty.Edit

function TAboutProperty.GetAttributes: TPropertyAttributes;
begin
  Result:=[paDialog];
end; // TAboutProperty.GetAttributes

procedure TAboutProperty.SetValue(const aVal: string);
begin
  // Eingaben immer mit Versionsinfo überschreiben.
  SetStrValue(GetValue);
end; // TAboutProperty.SetValue

function TAboutProperty.GetValue: string;
begin
  Result:=Format(ilFMTVERSION, [ilVERSION]);
end; // TAboutProperty.GetValue


In der register.pas musst Du dann den About-Dialog mit
ausblenden Delphi-Quelltext
1:
  RegisterPropertyEditor(TypeInfo(String), TMyKompo, 'About', TAboutProperty);					

registrieren.

Ich hoffe, o.g. Beispiel hilft.


Uups, habe ich fast vergessen: Dem Package musst Du noch unter Requires die Datei designide.dcp angeben.

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
FriFra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 557

Win XP Prof, Win XP Home,Win Server 2003,Win 98SE,Win 2000,Win NT4,Win 3.11,Suse Linux 7.3 Prof,Suse Linux 8.0 Prof
D2k5 Prof, D7 Prof, D5 Standard, D3 Prof, K3 Prof
BeitragVerfasst: Do 09.10.03 21:22 
Danke ;) , jetzt hab ich's endlich kapiert :dance: :dance2:

Nach ein bischen Bastelei funktioniert es nun... Jetzt sieht die Komponente endlich Professionell aus 8)

_________________
Michael
(principal certified lotus professional - developer)