AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Tutorials Delphi Lösung: Das leidige Problem mit der DsgnIntf bzw. Proxy.dcu
Tutorial durchsuchen
Ansicht
Themen-Optionen

Lösung: Das leidige Problem mit der DsgnIntf bzw. Proxy.dcu

Ein Tutorial von MaBuSE · begonnen am 9. Nov 2004 · letzter Beitrag vom 27. Mär 2007
 
Benutzerbild von mandoki
mandoki

Registriert seit: 20. Feb 2006
Ort: Kiel
48 Beiträge
 
Delphi 7 Professional
 
#33

Re: Lösung: Das leidige Problem mit der DsgnIntf bzw. Proxy.

  Alt 10. Okt 2006, 19:31
Hallo,

habe für ein früheres Projekt die D5 Komponente ALSTipDialog verwendet. Leider gelingt es mir nicht, trotz ausführlichen Lesens der Tipps hier und des Tutorial, diese für D7 entsprechend anzupassen (Trennung des Design). Hatte mich leider nie mit der Komponentenentwicklung auseinandergesetzt (was sich nun wohl rächt).

Hier mal der erste Teil der Unit:

Delphi-Quellcode:
unit ALSTDlg;

interface

uses
  {$IFDEF WIN32}Windows,{$ELSE}WinTypes, WinProcs,{$ENDIF}
  Messages, SysUtils, Classes, Graphics, Controls, Forms,
  DesignIntf, DesignEditors, Dialogs, INIFiles{$IFDEF WIN32}, Registry{$ENDIF};

type
  TALSShowPos = (posScreenCenter, posFormCenter);
  TTipLocation = (locEmbeded, {$IFDEF WIN32}locRegistry,{$ENDIF} locINIFile);
  TRegRoot = (CURRENT_USER,LOCAL_MACHINE,CURRENT_CONFIG);

  TTipDialogEditor = class(TDefaultEditor)
  public
    procedure ExecuteVerb(Index : Integer); override;
    function GetVerb(Index : Integer): string; override;
    function GetVerbCount : Integer; override;
    procedure Edit; override;
  end;

  TAbout = class(TPropertyEditor)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
  end;

  TFileNameProperty = class (TStringProperty)
  public
      function getattributes: TPropertyattributes; override;
      procedure Edit; override;
  end;


  TALSTipDlg = class(TComponent)
  private
    FAbout : TAbout;
    FDlgCaption : string;
    FTipTitle : string;
    FTips : TStrings;
    FTipTitleFont : TFont;
    FTipFont : TFont;
    FRegRoot : TRegRoot;
    FRegKey : string;
    FINIFile : string;
    FINISection : string;
    FTipsLocation : TTipLocation;
    FPanelColor : TColor;
    FCRLFSubst : string;
    FRandomTips : boolean;
    FShowAtStartup: boolean;
    FPosition : TALSShowPos;
  protected
    {$IFDEF WIN32}
    function ReadFromRegistry : boolean;
    {$ENDIF}
    function ReadFromINIFile : boolean;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure SetTipValues(Value: TStrings);
    procedure SetTitleFont(Value: TFont);
    procedure SetTipFont(Value: TFont);
    function Execute : boolean;
  published
    property About: TAbout read FAbout write FAbout;
    property DlgCaption: string read FDlgCaption write FDlgCaption;
    property TipTitle: string read FTipTitle write FTipTitle;
    property Tips: TStrings read FTips write SetTipValues;
    property TipTitleFont: TFont read FTipTitleFont write SetTitleFont;
    property TipFont: TFont read FTipFont write SetTipFont;
    {$IFDEF WIN32}
    property RegistryRoot: TRegRoot read FRegRoot write FRegRoot default CURRENT_USER;
    property RegistryKey: string read FRegKey write FRegKey;
    {$ENDIF}
    property INIFile: string read FINIFile write FINIFile;
    property INISection: string read FINISection write FINISection;
    property TipsLocation: TTipLocation read FTipsLocation write FTipsLocation default locEmbeded;
    property PanelColor: TColor read FPanelColor write FPanelColor default
                         {$IFDEF VER120}clInfoBk {$ELSE} TColor($00E1FFFF){$ENDIF};
    property CRLFSubstitute : string read FCRLFSubst write FCRLFSubst;
    property RandomTips: boolean read FRandomTips write FRandomTips default False;
    property ShowAtStartup: boolean read FShowAtStartup write FShowAtStartup default True;
    property Position: TALSShowPos read FPosition write FPosition;
  end;

procedure Register;

implementation

uses TipFrm;
{$IFDEF WIN32}
  {$R ALSTDLG.R32}
{$ELSE}
  {$R ALSTDLG.R16}
{$ENDIF}

procedure Register;
begin
  RegisterComponents('Samples', [TALSTipDlg]);
  RegisterComponentEditor(TALSTipDlg, TTipDialogEditor);
  RegisterPropertyEditor(TypeInfo(TAbout), TALSTipDlg, 'ABOUT', TAbout);
  RegisterPropertyEditor(Typeinfo(string), TALSTipDlg, 'INIFile', TFileNameProperty);
end;
Welche Teile müssten den nun in den dsgn teil ausgelagert werden?

Habe 3 andere Free 'Tip of the Day' Komponenten getestet, aber leider waren diese alle nicht so funktionell und flexibel wie die ALSTipDialog.

Hat die vielleicht mal jemand bereits für Delphi 7 angepasst?
Oder kennt jemand eine ähnlich gute Komponente (keine jv,lmd,max)?


Hänge den Sourcecode der ALSTipDialog mal dran..

Gruß mandoki
Angehängte Dateien
Dateityp: zip alstipdialog_127.zip (31,2 KB, 13x aufgerufen)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:04 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz