Print Page | Close Window

How to resize(cut) text in CXTPTabClientWnd Tab

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=11105
Printed Date: 12 September 2025 at 5:50am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How to resize(cut) text in CXTPTabClientWnd Tab
Posted By: hikaroute
Subject: How to resize(cut) text in CXTPTabClientWnd Tab
Date Posted: 19 June 2008 at 4:35am
I use CXTPTabClientWnd for create MTI Bar, Anything is OK.  But when I open file(s) that have the long path, it shows only the first part of the full text around 30 charactors in the tab (but it's not the file name I need to show).  Then I have some question to ask.
 
- If I need to cut only the filename and extension, how should I do?  Because I show the full path on the title bar already.
- How to set the tooltip when I move the cursor over the tab of them for show the full path?
 
Thank you.



Replies:
Posted By: hikaroute
Date Posted: 20 June 2008 at 1:41pm
hi, don't have anyone who know how to fix my problem?  And oleg, can you help me?


Posted By: Smucker
Date Posted: 20 June 2008 at 7:18pm
CXTPTabClientWnd::AddItem() returns a pointer to a CXTPTabManagerItem object, which you can then use to set the tab caption and tool tip.

Something like:

class HikaTabClientWnd : CXTPTabClientWnd
{
public:
  BOOL AddTabWindow(CString& fullname, CWnd* pwnd);
};

BOOL HikaTabClientWnd::AddTabWindow(CString& fullname, CWnd* pwnd)
{
  GetPaintManager()->m_bDrawTextPathEllipsis = TRUE;        // In case name+ext too long
  CXTPTabManagerItem *pitem = AddItem(pwnd);                // Add the window
  if (pitem) {
    CXTSplitPath spath(fullname);                           // Split the path
    pitem->SetCaption(spath.GetFName() + spath.GetExt());   // Set the tab caption (name.ext)
    pitem->SetTooltip(fullname);                            // Set the tool tip to the full path
    return TRUE;
  }
  return FALSE;
}



Posted By: mmh
Date Posted: 31 December 2010 at 5:08am
Hi.
 
If i have to trim the caption in runtime.,? wat should be done..  ie. based on the available rect i should display full caption or with 3 dots., like "Tabs Full Ca..."



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