Einzelnen Beitrag anzeigen

Benutzerbild von FriFra
FriFra

Registriert seit: 19. Apr 2003
1.291 Beiträge
 
Delphi 2005 Professional
 
#3

Re: About-Dialog in Komponente

  Alt 3. Okt 2003, 15:31
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.
Elektronische Bauelemente funktionieren mit Rauch. Kommt der Rauch raus, geht das Bauteil nicht mehr.
  Mit Zitat antworten Zitat