TOOLTIP FONT HINT PROPERTIES
// ******************************************************************
// TOOLTIP FONT HINT PROPERTIES
// Category : Hint/ToolTip
// Author : Zarko Gajic
// Author Email : delphi.guide@about.com
// Author Web : http://www.delphi.about.com
// Tips Website : About Delphi Pages
// Tips Website URL: http://www.delphi.about.com
// ******************************************************************
{Change the font in Tool Tip (Hint box)}
Type
TMyHintWindow = Class (THintWindow)
Constructor Create (AOwner: TComponent);override;
end;
Constructor TMyHintWindow.Create(AOwner:TComponent);
begin
Inherited Create (AOwner);
Canvas.Font.Name := ‘Courier New’;
Canvas.Font.Size := 72;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowHint := false;
HintWindowClass := TMyHintWindow;
Application.ShowHint := True;
end;
MULTILINES HINT
// ******************************************************************
// MULTILINES HINT
// Category : Hint/ToolTip
// Author : Greatis Software
// Author Email :
// Author Web : www.greatissoftware.com
// Tips Website : Greatis Software
// Tips Website URL: http://www.greatis.com/delphi/tips.html
// ******************************************************************
{
Creating multiline hint is not so difficult. Set ShowHint of Button1 to True and
try this:
}
procedure TForm1.FormCreate(Sender: TObject);
begin
Button1.Hint:=’Greatis’+#13+’Delphi Pages’;
end;
MORE LINES IN A HINT
// ******************************************************************
// MORE LINES IN A HINT
// Category : Hint/ToolTip
// Author : Studiebureau Festraets
// Author Email :
// Author Web : http://www.festra.com/eng/index.html
// Tips Website : Delphi Land
// Tips Website URL: http://www.festra.com/eng/index.html
// ******************************************************************
{
If you want to display more than a one line in the hint of a component, for
example of Button1, set it’s property ShowHint to true. In the Object Inspector,
don’t put anything in Button1’s hint property.
In the FormCreate event handler of the form that contains Button1, add this line:
Button1.Hint := ‘First line’ + Chr(13) + ‘Second line’;
}
CREATE YOUR OWN HINTS
// ******************************************************************
// CREATE YOUR OWN HINTS
// Category : Hint/ToolTip
// Author : Domas Savickas
// Author Email : domass@takas.lt
// Author Web : http://ddelphi.hypermart.net/delphi
// Tips Website : Domas Delphi Pages
// Tips Website URL: http://ddelphi.hypermart.net/delphi
// ******************************************************************
{
If you don’t quite like the way how Delphi’s default hints look like,
you can use THintWindow component to create your own customized hint window.
Here’s an example:
}
var
h : THintWindow;
r : TRect;
begin
with r do
begin
//
// set the position and size
// of the hint window
//
left := 10;
top := 50;
right := 200;
bottom := 100;
end;
h := THintWindow.Create( Self );
with h do
begin
//
// set the background color
//
Color := clRed;
ActivateHint( r, ‘hi there!’ );
//
// perform your tasks here
// before closing the hint window
//
MessageBox( 0,
‘Press any key to close the ‘
+ ‘hint window’,
‘THintWindow’,
MB_OK );
ReleaseHandle;
Free;
end;
end;
CREATE A NONSTANDARD REGION OF HINT
// ******************************************************************
// CREATE A NONSTANDARD REGION OF HINT
// Category : Hint/ToolTip
// Author : Greatis Software
// Author Email :
// Author Web : www.greatissoftware.com
// Tips Website : Greatis Software
// Tips Website URL: http://www.greatis.com/delphi/tips.html
// ******************************************************************
{
First of all, you should create a new class with ActiveHint procedure. When you
create form, you should set HintWindowClass to your new class (TMyHint).
Try this:
}
TMyHint = class(THintWindow)
private
FRegion: THandle;
public
procedure ActivateHint(Rect: TRect; const AHint: string); override;
end;
// …
procedure TMyHint.ActivateHint(Rect: TRect; const AHint: string);
begin
SetWindowRgn(Handle, 0, True);
DeleteObject(FRegion);
BoundsRect:=Rect;
FRegion:=CreateEllipticRgn(0,0,Width,Height);
SetWindowRgn(Handle, FRegion, True);
inherited ActivateHint(Rect, AHint);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.ShowHint:=False;
HintWindowClass:=TMyHint;
Application.ShowHint:=True;
end;
COLOR AND TIMING OF HINTS
// ******************************************************************
// COLOR AND TIMING OF HINTS
// Category : Hint/ToolTip
// Author : Studiebureau Festraets
// Author Email :
// Author Web : http://www.festra.com/eng/index.html
// Tips Website : Delphi Land
// Tips Website URL: http://www.festra.com/eng/index.html
// ******************************************************************
{
In the OnCreate (or in the OnShow) event handler of the main form of the
application, write this code:
}
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.HintColor := clAqua; // or another color
Application.HintPause := 250; // 250 mSec before hint is shown
Application.HintHidePause:=3000; // hint disappears after 3 secs
end;
-
Archives
- November 2007 (8)
- October 2007 (32)
-
Categories
-
RSS
Entries RSS
Comments RSS