Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to change content of MDI tooltip ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to change content of MDI tooltip ?

 Post Reply Post Reply
Author
Message
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post Topic: How to change content of MDI tooltip ?
    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

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
freehawk View Drop Down
Groupie
Groupie


Joined: 22 April 2004
Status: Offline
Points: 95
Post Options Post Options   Thanks (0) Thanks(0)   Quote freehawk Quote  Post ReplyReply Direct Link To This Post 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.

 

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
JayW View Drop Down
Newbie
Newbie


Joined: 25 May 2005
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote JayW Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.031 seconds.