Print Page | Close Window

How to change content of MDI tooltip ?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=2669
Printed Date: 08 November 2025 at 7:15pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to change content of MDI tooltip ?
Posted By: freehawk
Subject: How to change content of MDI tooltip ?
Date Posted: 01 August 2005 at 10:23pm

Hello

There are some tabbed MDI child window. When mouse is moved onto the tab of MDI child window,  the tooltip (example: full path of file ) is displayed, Now I want to change the content of tooltip, Please help me how to do? Thank you.

-Freehawk




Replies:
Posted By: Oleg
Date Posted: 03 August 2005 at 4:36am

Hi,

Option 1.

Override

virtual CString CXTPTabClientWnd::GetItemTooltip(const CXTPTabManagerItem* pItem) const;

and return tooltip you need.

 

Option 2.

catch WM_XTP_GETWINDOWTOOLTIP in CChildFrm and return

LPCTSTR string with tooltip.

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: freehawk
Date Posted: 10 August 2005 at 12:06am

How to change the tooltip?

The following way is "How to get the tooltip".

Originally posted by oleg oleg wrote:

Hi,

Option 1.

Override

virtual CString CXTPTabClientWnd::GetItemTooltip(const CXTPTabManagerItem* pItem) const;

and return tooltip you need.

 

Option 2.

catch WM_XTP_GETWINDOWTOOLTIP in CChildFrm and return

LPCTSTR string with tooltip.

 



Posted By: Oleg
Date Posted: 10 August 2005 at 3:50am

 

in CChildFrame.h add new member CString m_strCurrentTooltip.

- to change it call

m_strCurrentTooltip = "New Tooltip".

- to get it use "option 2"



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: JayW
Date Posted: 11 August 2005 at 2:10pm

To clarify a bit, I asssume Oleg means to do the following:

A) Add the class variable m_strCurrentTooltip to the CMDIChildWnd-derived child frame class for the doc/view template to store the text for the tooltip.

B) Install a message handler to trap the WM_XTP_GETWINDOWTOOLTIP message in the ChildFrm class and return the value of the m_strCurrentTooltip variable. (The message is issued by CXTPTabClientWnd::GetItemTooltip() which is used by the XTP framework to get the tooltip text before setting it, so while it seems like a "Get" method, it behaves as a "Set" method in this case.)

Code as follows:

In the "MyChildFrm.h" file include the following:

    CString m_strCurrentTooltip;

and, define the message handler:

protected:

    afx_msg LRESULT OnGetItemTooltip(WPARAM wParam, LPARAM lParam);

    DECLARE_MESSAGE_MAP()

 

In the "YourChildFrm.cpp" file include the following:

BEGIN_MESSAGE_MAP(MyChildFrm, CMDIChildWnd)

    ON_MESSAGE(WM_XTP_GETWINDOWTOOLTIP, OnGetItemTooltip)

END_MESSAGE_MAP()

 

/*

* Example: Change the tooltip from the full path of the

* document file (default) to the document title.

*/

LRESULT CTextEditCFrm::OnGetItemTooltip(WPARAM wParam, LPARAM lParam)

{

    if (m_strCurrentTooltip.IsEmpty())

        m_strCurrentTooltip = this->GetActiveDocument()->GetTitle();

    return (LRESULT) (LPCTSTR) m_strCurrentTooltip;

}

 

I hope that helps. (Oleg's posts have saved me countless hours... )

Jay




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net