Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - How to change title of a Tab. But not doc-title
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to change title of a Tab. But not doc-title

 Post Reply Post Reply
Author
Message
Sacha View Drop Down
Newbie
Newbie


Joined: 04 January 2007
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sacha Quote  Post ReplyReply Direct Link To This Post Topic: How to change title of a Tab. But not doc-title
    Posted: 04 January 2007 at 4:24am
Hallo!

I have that problem.
I creat a doc and show it in a MDI with taps. now i open a part of this doc in a new view with a new tab. But the new tab hase the same title (the title of the doc). If i change the title with SetTitle() it change the title from the first tab also.

Pleas Help.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 04 January 2007 at 6:04am
Hi,
Catch WM_XTP_GETWINDOWTEXT message in CChildFrame and reeturn (LPCTSTR) points to Tab Caption you need.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Sacha View Drop Down
Newbie
Newbie


Joined: 04 January 2007
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Sacha Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2007 at 7:30am
Oh thank you it works
Back to Top
leo_12 View Drop Down
Groupie
Groupie
Avatar

Joined: 12 April 2005
Location: Germany
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote leo_12 Quote  Post ReplyReply Direct Link To This Post Posted: 16 January 2007 at 12:00pm
Hi Oleg,
 
I have implemented a message handler as you suggested, but the compiler constantly tells me that he cannot convert from LPCTSTR to LRESULT.
 
So, what's wrong with my code below?
 
Heiko
 
LRESULT ChildFrame::OnGetTabText(WPARAM /*wParam*/, LPARAM /*lParam*/)
{

MyDocument* pDoc = dynamic_cast<MyDocument*>(GetActiveDocument());

if (pDoc != NULL)

{

m_strTabTitle = pDoc->GetText();

return (LPCTSTR)m_strTabTitle;

}

return 0;

}

Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 17 January 2007 at 8:47am
Hi Heiko;
 
You have to cast m_strTabTitle to LRESULT not to LPCTSTR!
The sender of the message knows how to interpret the LRESULT param - in this case its a const pointer to a string.
 
try
 
return reinterpret_cast<LRESULT>(m_strTabTitle);
 
or if m_strTabTitle is of type CString
 
return reinterpret_cast<LRESULT>(reinterpret_cast<LPCTSTR>(m_strTabTitle));
 
You can do it also in old C style... return (LRESULT)m_strTabTitle
 
Martin

Product: Xtreme Toolkit v 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
leo_12 View Drop Down
Groupie
Groupie
Avatar

Joined: 12 April 2005
Location: Germany
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote leo_12 Quote  Post ReplyReply Direct Link To This Post Posted: 17 January 2007 at 9:28am
Thanks Martin,
 
the cast (LRESULT)((LPCTSTR)m_strTabTitle) works. Maybe the help-topics of WM_XTP_GETWINDOWTEXT  and WM_XTP_GETWINDOWTOOLTIP should be updated.
 
Heiko
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.156 seconds.