Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-06-2006, 09:21 AM
Jasser Jasser is offline
Moderator
 
Join Date: Jan 2005
Location: Saudi Arabia
Posts: 5,060
Default Balloon.

I use this procedure to show some balloon tips and it works fine except that it does not stay forlong. How make it stay until the user clicks on it?

[DELPHI]USES CommCtrl;
.................................................. .........
.................................................. .........
procedure ShowBalloonTip(Control: TWinControl; Icon: integer; sTitle: String; sText: WideString; iBackColor : TColor = -1; iTextColor : TColor = -1);
const
TOOLTIPS_CLASS = 'Tooltips_Class32';

TTS_ALWAYSTIP = $01;

TTS_NOPREFIX = $02;

TTS_BALLOON = $40;

TTF_SUBCLASS = $0010;

TTF_TRANSPARENT = $0100;

TTF_CENTERTIP = $0002;

TTM_ADDTOOL = $0400 + 50;

TTM_SETTITLE = (WM_USER + 32);

ICC_WIN95_CLASSES = $000000FF;
NIN_BALLOONTIMEOUT = WM_USER + 4;


type TOOLINFO = packed record
cbSize: Integer;
uFlags: Integer;
hwnd: THandle;
uId: Integer;
rect: TRect;
hinst: THandle;
lpszText: PWideChar;
lParam: Integer;
end;

var
ti: TOOLINFO;

hControl: THandle;
hWindow : THandle;
begin
hControl := Control.Handle;
hWindow := CreateWindow(TOOLTIPS_CLASS, nil,WS_POPUP or TTS_NOPREFIX or TTS_BALLOON or TTS_ALWAYSTIP,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hControl, 0, HInstance, nil);

if hWindow = 0 then
exit;

SetWindowPos(hWindow, HWND_TOPMOST, 0, 0, 0, 0,SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);

ti.cbSize := SizeOf(ti);
ti.uFlags := TTF_TRANSPARENT or TTF_SUBCLASS or TTF_CENTERTIP;
ti.hwnd := hControl;
ti.lpszText := PWideChar(sText);

Windows.GetClientRect(hControl, ti.rect);

if iBackColor <> -1 then
SendMessage(hWindow, TTM_SETTIPBKCOLOR, iBackColor, 0);

if iTextColor <> -1 then
SendMessage(hWindow, TTM_SETTIPTEXTCOLOR, iTextColor, 0);

SendMessage(hWindow, TTM_ADDTOOL, 1, Integer(@ti));
SendMessage(hWindow, TTM_SETTITLE, Icon mod 4, Integer(PChar(sTitle)));
end;[/DELPHI]

Regards,
Abdulaziz Jasser
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 04:31 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.