CToolTip

Win32++

CToolTip Class

Description

The CToolTip class adds support for the tool tip control. ToolTips appear automatically, or pop up, when the user pauses the mouse pointer over a tool or some other UI element. The ToolTip appears near the pointer and disappears when the user clicks a mouse button, moves the pointer away from the tool, or simply waits for a few seconds.

CToolTip Members

Construction
CToolTip
CToolTip();
Constructs a tool tip control.
  Attributes GetBubbleSize
CSize GetBubbleSize(LPTOOLINFO lpToolInfo) const;
Returns the width and height of the ToolTip control. GetDelayTime
int GetDelayTime(DWORD dwDuration) const;
Retrieves the initial, pop-up, and reshow durations currently set for the ToolTip control. GetMargin
void GetMargin(LPRECT lprc) const;
Retrieves the top, left, bottom, and right margins set for the ToolTip window. GetMaxTipWidth
int GetMaxTipWidth() const;
Retrieves the maximum width for the ToolTip window. GetText
void GetText(CString& str, CWnd* pWnd, UINT_PTR nIDTool = 0) const;
Retrieves the text from the tool tip control. GetTipBkColor
COLORREF GetTipBkColor() const;
Retrieves the background color in the ToolTip window. GetTipTextColor
COLORREF GetTipTextColor() const;
Retrieves the text color in a ToolTip window. GetToolCount
int GetToolCount() const;
Retrieves a count of the tools maintained by the ToolTip control. GetToolInfo
BOOL GetToolInfo(TOOLINFO& ToolInfo, CWnd* pWnd, UINT_PTR nIDTool = 0) const;
Retrieves the information that a ToolTip control maintains about the tool. SetDelayTime
void SetDelayTime(UINT nDelay);
void SetDelayTime(DWORD dwDuration, int iTime);
Sets the initial, pop-up, and reshow durations for the ToolTip control SetMargin
void SetMargin(LPRECT lprc);
Sets the top, left, bottom, and right margins for the ToolTip window. SetMaxTipWidth
int SetMaxTipWidth(int iWidth);
Sets the maximum width for the ToolTip window. SetTipBkColor
void SetTipBkColor(COLORREF clr);
Sets the background color in the ToolTip window. SetTipTextColor
void SetTipTextColor(COLORREF clr);
Sets the text color in the ToolTip window. SetToolInfo
void SetToolInfo(LPTOOLINFO lpToolInfo);
Sets the information that the ToolTip control maintains for a tool.   Operations Activate
void Activate(BOOL bActivate);
Activates or deactivates the ToolTip control. AddTool
BOOL AddTool(CWnd* pWnd, UINT nIDText, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);
BOOL AddTool(CWnd* pWnd, LPCTSTR lpszText = LPSTR_TEXTCALLBACK, LPCRECT lpRectTool = NULL, UINT_PTR nIDTool = 0);
Registers a tool with a ToolTip control. AdjustRect
BOOL AdjustRect(LPRECT lprc, BOOL bLarger = TRUE);
Calculates a ToolTip control's text display rectangle from its window rectangle, or the ToolTip window rectangle needed to display a specified text display rectangle. DelTool
void DelTool(CWnd* pWnd, UINT_PTR nIDTool = 0);
Removes a tool from the ToolTip control. HitTest
BOOL HitTest(CWnd* pWnd, CPoint pt, LPTOOLINFO lpToolInfo) const;
Tests a point to determine whether it is within the bounding rectangle of the specified tool and, if it is, retrieves information about the tool. Pop
void Pop();
Removes a displayed ToolTip window from view. RelayEvent
void RelayEvent(LPMSG lpMsg);
Passes a mouse message to a ToolTip control for processing. SetTitle
BOOL SetTitle(UINT uIcon, LPCTSTR lpstrTitle);
Adds a standard icon and title string to a ToolTip. SetToolRect
void SetToolRect(CWnd* pWnd, UINT_PTR nIDTool, LPCRECT lpRect);
Sets a new bounding rectangle for the tool. SetWindowTheme
void SetWindowTheme(LPCWSTR lpstrTheme);
Sets the visual style of a ToolTip control. Update
void Update();
Forces the current tool to be redrawn. UpdateTipText
void UpdateTipText(LPCTSTR lpszText, CWnd* pWnd, UINT_PTR nIDTool = 0);
void UpdateTipText(UINT nIDText, CWnd* pWnd, UINT_PTR nIDTool = 0);
Sets the ToolTip text for a tool.
Base class Members

For base class members, refer to the members of CWnd.

Remarks

ToolTip controls can display a single line of text or multiple lines. Their corners can be rounded or square. They might or might not have a stem that points to the tools like a cartoon speech balloon. ToolTip text can be stationary or can move with the mouse pointer, called tracking. Stationary text can be displayed adjacent to a tool or it can be displayed over a tool, which is referred to as in-place. Standard ToolTips are stationary, display a single line of text, have square corners, and have no stem pointing to the tool.

Summary Information

Header file controls.h
Win32/64 support Yes
WinCE support Yes