Click here to Skip to main content
Click here to Skip to main content
Go to top

Tool tip on window

, 16 Oct 2001
Rate this:
Please Sign up or sign in to vote.
Tooltips for window according to specified rectangular areas of that window

Sample Image - WindowTip.jpg

Introduction

In windows world ToolTips are very important from users point of view and developers used to provide this facility to user. As we know that MFC does not provide tool tip for a part of window (It provides tool tips for controls) so this source will help to give tool tip for specified regions of window. This is very useful for those people who deals with drawings because through this they can give tool tip to their drawings.

How to use the source code

Include the following files in your project

  1. WindowTip.h
  2. WindowTip.cpp

First Create the ToolTip window as soon as you create your parent window on that you want to display the tool tip

CWindowTip m_MyTip; // Create the object
m_MyTip.SetDelay(1000); // Set the Display delay
m_MyTip.CreateTipWnd(this); // Create the Window

Now call ShowTip function in mouse move of parent window

m_MyTip.ShowTip(point); // Pass current mouse position

And now add as much tips you want to add by using Following method.

1. Create an object of CTipInfo

2. Set region and text for tip using SetReagion and SetText

3. Finally add this using AddTip method of CWindowTip

CTipInfo info(CRect(0, 0, 100, 100),
              "Top Left corner of Window");
m_MyTip.AddTip(info);   

// specifies bottom right corner of window
CRect t_rect;
GetClientRect(&t_rect); // Gets the Parent 
                        // Window Client area
t_rect.top = t_rect.bottom - 100 ;
t_rect.left = t_rect.right - 100 ;
info.SetReagion(t_rect);
info.SetText("Bottom Right corner of Window");
m_MyTip.AddTip(info);

// specifies middle area of window
t_rect.top  = t_rect.bottom / 2 - 50;
t_rect.left = t_rect.right / 2 - 50;
t_rect.bottom = t_rect.top + 100;
t_rect.right = t_rect.left + 100;
info.SetReagion(t_rect);
info.SetText("Middle area of window");
m_MyTip.AddTip(info);

How to use Demo project

  • Just double click on ToolTip.exe
  • Double click on window to set the ToolTips
  • Move the mouse to top left, middle and right corner of window and wait for a second.

Future Work ...

  1. Use Region instead of Rectangle
  2. Provide Font, Pen and Brush customization
  3. To Give a small link on tip

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

onlyrakesh
Web Developer
India India
I am a Software Professional and Currently working in C-DAC (Centre For Development of Advanced Computing). This is a Scientific Socity under ministry of india of Information Technology.
I have completed My B.C.A. Degree with 77% marks, I am certified by microsofr as Microsoft Certified Professional in Visual Basic 6.0(70-176). Currently working on Visual C++ 6.0 and Using MFC support in my Applicaitons.
For Future Studying 3D graphics desinging like OpenGL and DirectX.

Comments and Discussions

 
GeneralMy vote of 2 PinmemberMember 200757013-Jun-11 23:19 
GeneralTool l tip on window Pinmemberelemella lavanya19-Mar-09 1:21 
QuestionHow can I make It work with CScrollView ? PinmemberLaan8222-Oct-08 21:44 
QuestionCan the class show the tips in "multi-line" style? Pinmemberlaohubinbin30-Mar-05 0:52 
AnswerRe: Can the class show the tips in "multi-line" style? Pinmemberchris17511-Nov-05 0:36 
GeneralRe: Can the class show the tips in "multi-line" style? Pinmemberurb012324-Nov-07 15:49 
GeneralTool tip doesn't show in Dialog application. PinmemberAndrew Fox29-Jan-04 23:07 
GeneralRe: Tool tip doesn't show in Dialog application. PinmemberAndrew Fox29-Jan-04 23:17 
Generalprevious window blink PinmemberIvanhoeJugger3-Feb-03 1:39 
GeneralRe: previous window blink Pinmemberags19914-Aug-03 5:29 
GeneralMouse trails PinsussAnonymous31-Oct-02 17:31 
GeneralTooltip disappears if bottom right corner PinmemberCraig Miller20-Mar-02 9:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 17 Oct 2001
Article Copyright 2001 by onlyrakesh
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid