Print Page | Close Window

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

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=5979
Printed Date: 12 December 2024 at 11:39am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to change title of a Tab. But not doc-title
Posted By: Sacha
Subject: How to change title of a Tab. But not doc-title
Date 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.



Replies:
Posted By: Oleg
Date 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


Posted By: Sacha
Date Posted: 04 January 2007 at 7:30am
Oh thank you it works


Posted By: leo_12
Date 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;

}



Posted By: mgampi
Date 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 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: leo_12
Date 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



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