LabelLink oque está faltando para criar..?

Delphi

05/08/2008

Olá pesssoal!.

Atravéz da Revista Clube Delphi Nº 19 tem um exemplo de como criar um componente LabelLink, mas oque que acontece criei toda a unit mas não estou sabendo como procedre pra frente para criar esse compoente através dessa unit aqui em baixo.

Alguem pode me dar uma ajuda de como proceder..?



unit LabelLink;

interface

Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, ShellApi;

//O componente foi derivado de TCustonLabel, para que a
//propriedade Caption pudesse deixar de ser exibida no
//Object Inspector. Desta forma, a propriedade caption
//sempre será o e-mail que estiver na propriedade mail.

Type
TLabelLink = class(TCustomLabel)
Private
{Private declaratons}
FMail:String;
Procedure SetMail(Value:String);
Protected
{Protected declarations}
Public
{Public declarations}
Constructor Create(AOWner:TComponent);override;
Procedure Click;override;
Published
{Published declarations}
Property Mail:String read FMail Write SetMail;
Property Align;
Property Alignment;
Property Anchors;
Property AutoSize;
Property BiDiMode;
// Property Caption;
Property Color;
Property Constraints;
Property DragCursor;
Property DragKind;
Property DragMode;
Property Enabled;
Property FocusControl;
Property Font;
Property ParentBiDiMode;
Property ParentColor;
Property ParentFont;
Property ParentShowHint;
Property PopupMenu;
Property ShowAccelChar;
Property ShowHint;
Property Transparent;
Property Layout;
Property Visible;
Property WordWrap;
Property OnClick;
Property OnContextPopup;
Property OnDblClick;
Property OnDragDrop;
property OnDragOver;
Property OnEndDock;
Property OnEndDrag;
Property OnMouseDown;
Property OnMouseMove;
Property OnMouseUp;
Property OnStartDock;
Property OnStartDrag;
end;

Procedure Register;

implementation

Procedure Register;
Begin
RegisterComponents(´FG - Shareware´, [TLabelLink]);
End;


//Esta function verifica se o delphi está aberto.
Function DelhpiRunning:Boolean;
Begin
Result:= (FindWindow(´TAppBuilder´, Nil) <> 0 )And
(FindWindow(´TApplication´, Nil) <> 0 )
End;



Procedure TLabelLink.Click;
var
EMail:PChar;
begin
inherited;
EMail:= PChar(´mailto:´+FMail);
ShellExecute(Application.Handle, ´Open´, EMail,´´,´´,1);
End;

Constructor TLabelLink.Create(AOWner: TComponent);
begin
inherited;
//Caso o delphi não esteja aberto, será exibida então uma
//mensagem de com uma propaganda de criador do componente,
//ou qualquer outra mensagem.
if Not DelphiRunning then
Begin
Beep;
ShowMessage(´Delphi Company - by Meu Label Link´+
#13+ ´ www.google.com.br´);
End;

FMail:= ´google@google.com.br´;
Caption:= ´google@google.com.br´;
Font.Color:= clBlue;
Font.Style:= [fsUnderline];
Cursor:= crHandPoint;
end;

Procedure TLabelLink.SetMail(Value: string);
begin
FMail:= Value;
Caption:= Value;
Hint:= Value;
ShowHint:= Value;

end;
end.


Max.jgs

Max.jgs

Curtidas 0

Respostas

Max.jgs

Max.jgs

05/08/2008

Olá pesssoal!. Atravéz da Revista Clube Delphi Nº 19 tem um exemplo de como criar um componente LabelLink, mas oque que acontece criei toda a unit mas não estou sabendo como procedre pra frente para criar esse componente através dessa unit aqui em baixo. Alguem pode me dar uma ajuda de como proceder..? unit LabelLink; interface Uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ShellApi; //O componente foi derivado de TCustonLabel, para que a //propriedade Caption pudesse deixar de ser exibida no //Object Inspector. Desta forma, a propriedade caption //sempre será o e-mail que estiver na propriedade mail. Type TLabelLink = class(TCustomLabel) Private {Private declaratons} FMail:String; Procedure SetMail(Value:String); Protected {Protected declarations} Public {Public declarations} Constructor Create(AOWner:TComponent);override; Procedure Click;override; Published {Published declarations} Property Mail:String read FMail Write SetMail; Property Align; Property Alignment; Property Anchors; Property AutoSize; Property BiDiMode; // Property Caption; Property Color; Property Constraints; Property DragCursor; Property DragKind; Property DragMode; Property Enabled; Property FocusControl; Property Font; Property ParentBiDiMode; Property ParentColor; Property ParentFont; Property ParentShowHint; Property PopupMenu; Property ShowAccelChar; Property ShowHint; Property Transparent; Property Layout; Property Visible; Property WordWrap; Property OnClick; Property OnContextPopup; Property OnDblClick; Property OnDragDrop; property OnDragOver; Property OnEndDock; Property OnEndDrag; Property OnMouseDown; Property OnMouseMove; Property OnMouseUp; Property OnStartDock; Property OnStartDrag; end; Procedure Register; implementation Procedure Register; Begin RegisterComponents(´FG - Shareware´, [TLabelLink]); End; //Esta function verifica se o delphi está aberto. Function DelhpiRunning:Boolean; Begin Result:= (FindWindow(´TAppBuilder´, Nil) <> 0 )And (FindWindow(´TApplication´, Nil) <> 0 ) End; Procedure TLabelLink.Click; var EMail:PChar; begin inherited; EMail:= PChar(´mailto:´+FMail); ShellExecute(Application.Handle, ´Open´, EMail,´´,´´,1); End; Constructor TLabelLink.Create(AOWner: TComponent); begin inherited; //Caso o delphi não esteja aberto, será exibida então uma //mensagem de com uma propaganda de criador do componente, //ou qualquer outra mensagem. if Not DelphiRunning then Begin Beep; ShowMessage(´Delphi Company - by Meu Label Link´+ #13+ ´ www.google.com.br´); End; FMail:= ´google@google.com.br´; Caption:= ´google@google.com.br´; Font.Color:= clBlue; Font.Style:= [fsUnderline]; Cursor:= crHandPoint; end; Procedure TLabelLink.SetMail(Value: string); begin FMail:= Value; Caption:= Value; Hint:= Value; ShowHint:= Value; end; end.



GOSTEI 0
POSTAR