DELPHI / Open Source Ahmdialogs

(*
This File is Part of the AHM Triton Tools
for Borland Delphi and C++ Builder.

Copyright (c) 1995 – 1998 AHM
Alexander H. Mehlhorn

For more Information contact AHM at
E-Mail : [email protected]
ICQ : 176724
or URL http://www.ahm.co.za

AHM is copyright by Alexander H. Mehlhorn
All Parts of this Collection were developed,
designed and implemented by AHM

Under no Circumstances may you distribute this file
in this or any other format. This File is supplied
as Evaluation of Source only.

*)
unit AHMDialogs;

interface
{$I AHM.INC}
{$DEFINE AHMREGISTERED}
uses Windows, Classes,Forms,Graphics,Buttons;

type
TAHMAboutDlgsStr = String[30];
TAHMExecDlgStr = String[30];
TAHMBeeptype = (bNone,bDefault,bAsterix,bExclamation,bQuestion,bCriticalStop);
TAHMDialogComponent = class(TComponent)
private
FBeepType : TAHMBeeptype;
FAHMAboutStr : TAHMAboutDlgsStr;
FAHMExecDlgStr : TAHMExecDlgStr;
protected
public
Function Execute : Boolean; virtual;
published
property About : TAHMAboutDlgsStr read FAHMAboutStr write FAHMAboutStr stored False;
property DesignExecute : TAHMExecDlgStr read FAHMExecDlgStr write FAHMExecDlgStr stored False;
Property Sound : TAHMBeeptype read FBeepType write FBeepType default bNone;
end;
TAHMAdvDialogComponent = class(TAHMDialogComponent)
private
FFormCaption : String;
FWidth, FHeight : Integer;
FFormLeft, FFormTop : Integer;
FPosition : TPosition;
FBorderStyle : TFormBorderStyle;
FHelpContext : THelpContext;
FHelpFile : String;
protected
public
procedure SetFormProperties(AForm : TForm);
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
published
property FormCaption : String read FFormCaption write FFormCaption;
property FormWidth : Integer read FWidth write FWidth default 500;
property FormHeight : Integer read FHeight write FHeight default 350;
property Position : TPosition read FPosition write FPosition default poDesigned;
property FormTop : Integer read FFormTop write FFormTop default 0;
property FormLeft : Integer read FFormLeft write FFormLeft default 0;
property HelpContext : THelpContext read FHelpContext write FHelpContext default 0;
property Helpfile : String read FHelpFile write FHelpFile;
property BorderStyle : TFormBorderStyle read FBorderStyle write FBorderStyle default bsDialog;
end;
TAHMButtonDetails = class(TPersistent)
private
fvisible : boolean;
fconf : boolean;
fenabled : boolean;
fcmess : string;
fcaption : String;
fgly : TBitmap;
fhint : String;
fshint: Boolean;
fattach : TObject;
Procedure Invalidate;
Procedure Setglyph(value : TBitmap);
Procedure SetEnabled(value : Boolean);
Procedure SetVisible(value : Boolean);
Procedure SetCaption(value : String);
Procedure SetHint(value : String);
Procedure SetSHint(value : Boolean);
Protected
public
constructor Create(Attached : TObject);
published
Property Glyph : TBitmap read fgly write Setglyph stored true;
Property Visible:Boolean read fvisible write SetVisible default true;
Property Enabled : Boolean read fenabled write SetEnabled default true;
Property ConfirmOnPress : Boolean read fconf write fconf default True;
Property ConfirmMessage : String read fcmess write fcmess;
Property Caption : String read fcaption write SetCaption;
Property Hint : String read fhint write SetHint;
Property ShowHint : Boolean read fshint write SetSHint default true;
end;

procedure BuildDialogDetails;
implementation
uses SysUtils, Shellapi, Dialogs;

procedure ValidateRegister;
begin
{$IFDEF AHMUNREGISTERED}
if Date>EncodeDate(1999,03,03) then BuildDialogDetails;
{$ELSE}
if Date=EncodeDate(1980,07,07) then BuildDialogDetails;
{$ENDIF}
end;

constructor TAHMButtonDetails.Create(Attached : TObject);
begin
fattach:=Attached;
inherited Create;
fgly := TBitmap.create;
fvisible :=true;
fenabled:=true;
fconf := false;
end;

Procedure TAHMButtonDetails.Invalidate;
begin
if (fattach is TBitBtn) then (fattach as TBitBtn).Invalidate;
if (fattach is TSpeedButton) then (fattach as TSpeedButton).Invalidate;
end;

Procedure TAHMButtonDetails.SetGlyph(value : Tbitmap);
begin
fgly.assign(value);
fgly.dormant;
if (fattach is TBitBtn) then (fattach as TBitbtn).Glyph.assign(value);
if (fattach is TSpeedButton) then
begin
(fattach as TSpeedButton).Glyph.assign(value);
if value<>nil then
(fattach as TSpeedButton).NumGlyphs:=value.width div value.height;
end;
invalidate;
end;

Procedure TAHMButtonDetails.SetCaption(value : String);
begin
fCaption:=value;
if (fattach is TBitBtn) then (fattach as TBitbtn).Caption:=value;
if (fattach is TSpeedButton) then (fattach as TSpeedButton).Caption:=value;
invalidate;
end;

Procedure TAHMButtonDetails.SetEnabled(value : Boolean);
begin
fEnabled:=value;
if (fattach is TBitBtn) then (fattach as TBitbtn).Enabled:=value;
if (fattach is TSpeedButton) then (fattach as TSpeedButton).Enabled:=value;
invalidate;
end;

Procedure TAHMButtonDetails.SetSHint(value : Boolean);
begin
fSHint:=value;
if (fattach is TBitBtn) then (fattach as TBitbtn).ShowHint:=value;
invalidate;
end;

Procedure TAHMButtonDetails.SetHint(value : String);
begin
fHint:=value;
if (fattach is TBitBtn) then (fattach as TBitbtn).Hint:=value;
if (fattach is TSpeedButton) then (fattach as TSpeedButton).Hint:=value;
invalidate;
end;

Procedure TAHMButtonDetails.SetVisible(value : Boolean);
begin
fVisible:=value;
if (fattach is TBitBtn) then (fattach as TBitbtn).Visible:=value;
if (fattach is TSpeedButton) then (fattach as TSpeedButton).Visible:=value;
invalidate;
end;

Function TAHMDialogComponent.Execute : Boolean;
begin
result:=false;
case FBeepType of
bDefault : MessageBeep(MB_OK);
bAsterix : MessageBeep(MB_ICONAsterisk);
bExclamation : MessageBeep(MB_ICONEXCLAMATION);
bQuestion : MessageBeep(MB_ICONQUESTION);
bCriticalStop : MessageBeep(MB_ICONHAND);
end;
end;

constructor TAHMAdvDialogComponent.Create(AOwner : TComponent);
begin
FWidth := 500;
FHeight := 350;
FPosition := poDesigned;
FFormTop := 0;
FFormLeft := 0;
FHelpContext := 0;
FBorderStyle := bsDialog;
inherited Create(AOwner);
end;

destructor TAHMAdvDialogComponent.Destroy;
begin
inherited Destroy;
end;

procedure TAHMAdvDialogComponent.SetFormProperties(AForm : TForm);
begin
AForm.Caption:=FFormCaption;
AForm.Width:=FWidth;
AForm.Height:=FHeight;
AForm.Position:=FPosition;
AForm.Top:=FFormTop;
AForm.Left:=FFormLeft;
AForm.HelpContext:=FHelpContext;
{$IFDEF AHMINPRISE3}
AForm.HelpFile:=FHelpFile;
{$ENDIF}
AForm.BorderStyle:=FBorderStyle;
end;

procedure BuildDialogDetails;
begin
{$IFDEF AHMUNREGISTERED}
showmessage(‘Hi there,’+#13+
‘The AHM Dialog Components have been designed for building easy interfaces’+#13+
‘to your Application and since it makes your life easier and is not’+#13+
‘completely for free I am asking you kindly to register for it.’+#13#13+
‘- See the following Website or the Helpfile for more Information -‘+#13#13+
‘Thank you, Alexander Mehlhorn (AHM)’+#13#13+
‘- Watch out for updates ! -‘);
ShellExecute(0,’open’,PChar(‘http://www.ahm.co.za’),nil,nil,SW_NORMAL);
{$ELSE}
showmessage(‘Dear Registered ,’+#13+
‘Thank you for registering the AHM Dialog Components Triton 98.’+#13+
‘As development will proceed on this Set of Components I will’+#13+
‘be updating frequently. Please ensure that you keep up to date’+#13+
‘with any Development done by me. Watch http://www.ahm.co.za’+#13+
‘for new releases on Triton 98 for which you are a registered User.’+#13#13+
‘Thank you, Alexander Mehlhorn (AHM)’+#13+
‘For any information, problems or updates send mail to [email protected]’);
{$ENDIF}
end;

initialization
ValidateRegister;

end.

Yorumlar Yorum Yaz
Bu hazır kod’a ilk yorumu siz yapın!
KATEGORİLER
ADO.NET – ADO – 8
ASP – 240
ASP.NET – 24
C# – 75
C++ – 174
CGI – 8
COMPONENT – 5
DATABASE – 8
DELPHI – 247
FLASH – 49
– 537
– JSP – 43
JAVA SCRIPT – 494
PASCAL – 246
PERL – 11
PHP – 160
VISUAL BASIC – 338
VISUAL BASIC.NET – 39
WML – 9
XML – 2
Tüm Kategoriler

images

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir