🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2695

ToolTips Position and pop-up event.

#2695
From: Mike Collins
Date: Sun, 07 Jan 2007 22:05
68 lines
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);

      }
}
Technical Details
Message-ID: <45a16e59$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a6013b7884e74024,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mike Collins" <its@TheBottomOfThePost.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: ToolTips Position and pop-up event.
Date: Sun, 7 Jan 2007 22:05:03 -0000
Lines: 71
Organization: SDA Ltd
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.2826
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2826
NNTP-Posting-Host: 84.13.30.215
Message-ID: <45a16e59$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1168207449 84.13.30.215 (7 Jan 2007 14:04:09 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail