Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi About-Dialog in Komponente (https://www.delphipraxis.net/9758-about-dialog-komponente.html)

FriFra 3. Okt 2003 14:29


About-Dialog in Komponente
 
Liste der Anhänge anzeigen (Anzahl: 1)
Wie kann ich einen About Dialog in meine Komponente einbauen?

sakura 3. Okt 2003 14:32

Re: About-Dialog in Komponente
 
Dazu musst Du einen Hier im Forum suchenProperty and Editor bauen. Eine Basisanleitung findest Du hier:

http://www.delphipraxis.net/viewtopic.php?t=6916

...:cat:...

FriFra 3. Okt 2003 15:31

Re: About-Dialog in Komponente
 
Ich habe es jetzt hinbekommen ;)

Allerdings funktioniert es nur in Delphi7... Delphi5 und 6 kennen DesignEditors und DesignIntf nicht! Was kann man da tun?

Die Variants ist kein grosses Problem, da man die über entspr. Compilerschalter übergehen kann.

Delphi-Quellcode:
unit GetLocalMail;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
  Dialogs, StdCtrls, Registry, IniFiles, ActiveX, ShlObj, shellApi,
  ComCtrls, ComObj, DesignEditors, DesignIntf;

const
  COMP_VERSION = '1.0';

type
  TAboutGetLocalMail = class(TPropertyEditor)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
  end;
  TGetLocalMail = class(TComponent)
  private
    { Private-Deklarationen }
    fAbout: TAboutGetLocalMail;
    B_IFN: boolean;
    B_LN: boolean;
    B_OL: boolean;
    B_NS: boolean;
    B_OP: boolean;
    procedure SetIFN(const Value: boolean);
    procedure SetLN(const Value: boolean);
    procedure SetOL(const Value: boolean);
    procedure SetNS(const Value: boolean);
    procedure SetOP(const Value: boolean);
    procedure GetNotesMail;
    procedure GetOutlookMail;
    procedure GetNetscapeMail;
    procedure GetOperaMail;
    procedure GetMail;
  protected
    { Protected-Deklarationen }
  public
    { Public-Deklarationen }
    Mails: TStringList;
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    { Published-Deklarationen }
    property About: TAboutGetLocalMail read fAbout write fAbout;
    property IncludeFullname: boolean read B_IFN write SetIFN default True;
    property LotusNotes: boolean read B_LN write SetLN default False;
    property Outlook: boolean read B_OL write SetOL default True;
    property Netscape: boolean read B_NS write SetNS default True;
    property Opera: Boolean read B_OP write SetOP default True;

    procedure SetDefauls;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterPropertyEditor(TypeInfo(TAboutGetLocalMail), TGetLocalMail, 'ABOUT',
    TAboutGetLocalMail);
  RegisterComponents('FriFra', [TGetLocalMail]);
end;

procedure TAboutGetLocalMail.Edit;
begin
  //Aboutdialog anzeigen
  MessageDlg('TGetLocalMail Version ' + COMP_VERSION + #13#13 +
    'Copyright 2003 by M. Fritzsche'#13'http://www.frifra.de', mtInformation,
    [mbOK], 0);
end;

function TAboutGetLocalMail.GetAttributes: TPropertyAttributes;
begin
  Result := [paDialog, paReadOnly];
end;

function TAboutGetLocalMail.GetValue: string;
begin
  Result := 'Version ' + COMP_VERSION;
end;

constructor TGetLocalMail.Create(AOwner: TComponent);
begin
  inherited;
  Mails := TStringList.Create;
  SetDefauls;
end;

destructor TGetLocalMail.Destroy;
begin
  Mails.Free;
  inherited;
end;

procedure TGetLocalMail.SetIFN(const Value: boolean);
begin
  B_IFN := Value;
  GetMail;
end;

procedure TGetLocalMail.SetLN(const Value: boolean);
begin
  B_LN := Value;
  GetMail;
end;

procedure TGetLocalMail.SetOL(const Value: boolean);
begin
  B_OL := Value;
  GetMail;
end;

procedure TGetLocalMail.SetNS(const Value: boolean);
begin
  B_NS := Value;
  GetMail;
end;

procedure TGetLocalMail.SetOP(const Value: boolean);
begin
  B_OP := Value;
  GetMail;
end;

{ B E G I N N - Lotus Notes }

procedure TGetLocalMail.GetNotesMail;
begin
  Mails.Add('dummy@dummy.org');
end;
{ E N D E - Lotus Notes }

{ B E G I N N - Outlook und Outlook Express }

procedure TGetLocalMail.GetOutlookMail;
begin
  Mails.Add('dummy@dummy.org');
end;
{ E N D E - Outlook und Outlook Express }

{ B E G I N N - Netscape }

procedure TGetLocalMail.GetNetscapeMail;
begin
  Mails.Add('dummy@dummy.org');
end;
{ E N D E - Netscape }

{ B E G I N N - Opera 5-7 }

procedure TGetLocalMail.GetOperaMail;
begin
  Mails.Add('dummy@dummy.org');
end;
{ E N D E - Opera 5-7 }

{ B E G I N N - Alle ausgeben }

procedure TGetLocalMail.GetMail;
begin
  Mails.Clear;
  if B_LN = True then
    GetNotesMail;
  if B_OL = True then
    GetOutlookMail;
  if B_NS = True then
    GetNetscapeMail;
  if B_OP = True then
    GetOperaMail;
end;
{ E N D E - Alle Mailadressen ausgeben }

procedure TGetLocalMail.SetDefauls;
begin
  B_IFN := True;
  B_LN := False;
  B_OL := True;
  B_NS := True;
  B_OP := True;
  GetMail;
end;

end.

sakura 3. Okt 2003 15:33

Re: About-Dialog in Komponente
 
Auch mit einem Compilerschalter ersetzen. In den früheren Versionen waren die in der Unit dsgnintf zusammengefasst.

...:cat:...

sakura 3. Okt 2003 15:34

Re: About-Dialog in Komponente
 
Btw, für About nur read definieren, write ist wohl reichlich unnötig ;-)

...:cat:...

FriFra 3. Okt 2003 19:32

Re: About-Dialog in Komponente
 
So, jetzt hatte ich ein neues Problem...

Vielleicht findet ja jemand den Fehler:
http://www.delphipraxis.net/internal...?p=78041#78041


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:02 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz