Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by Mike Collins
Sun, 07 Jan 2007 22:05
ToolTips Position and pop-up event.
Author: Mike Collins
Date: Sun, 07 Jan 2007 22:05
Date: Sun, 07 Jan 2007 22:05
68 lines
3438 bytes
3438 bytes
Hi guys, just q quicky about tooltips - seems this topic has been discussed
quite a bit previous but i can't seem to find the answers to my problems.
Having read loads on the tooltip topic, I finally found a working example on
a russian site. The code produces the standard tooltip pop-up in resonce to
a mouse over (code example is shown at the bottom of the post).
However, I now have two seperate requirements and problems. The first is
that i need to position the tooltip below the control that it is being
displayed for. Currently it is displayed above the control. I have tried
using the SetWindowsPos but it doesn't seem to have any effect.
The second (and unrelated) problem that i have is that i want to display the
tooltip in responce to a users data entry. In IE's proxy setting, if you
try to enter a non-numeric value into the edit box, it displays a tooltip to
tell you this, I want to achieve the same thing. Obviously i know how to
process and check the data entry but i don't know how to force the
displaying of tooltip.
Thanks in advance.
Mike C
// code snippit
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
ShowBalloonTip(Edit1, 1, "User, ?? ?? ????.","????? ?????? ?????? ????
??????? ????? ??????.", clCream, clNavy);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ShowBalloonTip(TWinControl* Control,int Icon, char*
Title,
char* Text, TColor BackCL, TColor TextCL)
{
TOOLINFO ti;
THandle* hWndTip;
THandle* hWnd;
hWnd = (unsigned int*) Control->Handle;
hWndTip = (unsigned int*)CreateWindow("tooltips_class32",
NULL, WS_POPUP | TTS_NOPREFIX |
TTS_BALLOON | TTS_ALWAYSTIP,
0, 0, 0, 0, hWnd, 0, HInstance,
NULL);
if (hWndTip != 0)
{
SetWindowPos(hWndTip, HWND_TOPMOST, 0, 0, 0,
0,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
ti.cbSize=sizeof(ti);
ti.uFlags= NIF_INFO | TTF_ABSOLUTE; //NIF_INFO;//NIF_INFO ; //
TTF_CENTERTIP|TTF_TRANSPARENT|TTF_SUBCLASS;
ti.hwnd = hWnd;
::GetClientRect(hWnd, &ti.rect);
SendMessage(hWndTip, TTM_SETTIPBKCOLOR, BackCL, 0);
SendMessage(hWndTip, TTM_SETTIPTEXTCOLOR, TextCL, 0);
ti.lpszText=Text;
SendMessage(hWndTip,TTM_ADDTOOL, 1, (int)&ti);
SendMessage(hWndTip,TTM_SETTITLE, Icon % 4, (int)Title );
//SetWindowPos(hWndTip, HWND_TOPMOST, 200, 200, 0,
0,SWP_NOACTIVATE|SWP_NOSIZE);
}
}
Re: ToolTips Position and pop-up event.
Author: Damon Chandler (TeamB)
Date: Tue, 09 Jan 2007 09:36
Date: Tue, 09 Jan 2007 09:36
40 lines
2258 bytes
2258 bytes
Hi Mike, You might have already looked here, but this page... http://tinyurl.com/4q27u describes some techniques of positioning tooltips. In particular, have a look at the section "Tracking Tooltips," and the description of the TTF_CENTERTIP flag. Never tried any of this myself, but it sounds promising. This topic would also make for a good article :) Cheers, -- Damon (TeamB) C++Builder Developer's Journal http://bcbjournal.com BCB Commonly Asked Questions http://bcbjournal.com/bcbcaq Mike Collins wrote: > Hi guys, just q quicky about tooltips - seems this topic has been discussed > quite a bit previous but i can't seem to find the answers to my problems. > [snip] > > However, I now have two seperate requirements and problems. The first is > that i need to position the tooltip below the control that it is being > displayed for. Currently it is displayed above the control. I have tried > using the SetWindowsPos but it doesn't seem to have any effect. > > The second (and unrelated) problem that i have is that i want to display the > tooltip in responce to a users data entry. [snip] > > Thanks in advance. > > Mike C
Re: ToolTips Position and pop-up event.
Author: Mike Collins
Date: Tue, 09 Jan 2007 11:17
Date: Tue, 09 Jan 2007 11:17
48 lines
2547 bytes
2547 bytes
cheers damon - and happy new year :-) Yeh, seen that link but actually READING if properly now - will knock up a quick article on it when i know what i'm doing :o) "Damon Chandler (TeamB)" <editor@_REMOVE_THIS_SPAM_GUARD_bcbjournal.com> wrote in message news:45a36182$1@newsgroups.borland.com... > Hi Mike, > > You might have already looked here, but this page... > > http://tinyurl.com/4q27u > > describes some techniques of positioning tooltips. In particular, have a > look at the section "Tracking Tooltips," and the description of the > TTF_CENTERTIP flag. Never tried any of this myself, but it sounds > promising. > > This topic would also make for a good article :) > > Cheers, > -- > Damon (TeamB) > > C++Builder Developer's Journal > http://bcbjournal.com > BCB Commonly Asked Questions > http://bcbjournal.com/bcbcaq > > > Mike Collins wrote: >> Hi guys, just q quicky about tooltips - seems this topic has been >> discussed quite a bit previous but i can't seem to find the answers to my >> problems. >> > [snip] >> >> However, I now have two seperate requirements and problems. The first is >> that i need to position the tooltip below the control that it is being >> displayed for. Currently it is displayed above the control. I have >> tried using the SetWindowsPos but it doesn't seem to have any effect. >> >> The second (and unrelated) problem that i have is that i want to display >> the tooltip in responce to a users data entry. [snip] >> >> Thanks in advance. >> >> Mike C
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads