Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to resize(cut) text in CXTPTabClientWnd Tab
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to resize(cut) text in CXTPTabClientWnd Tab

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


Joined: 05 September 2007
Status: Offline
Points: 51
Post Options Post Options   Thanks (0) Thanks(0)   Quote hikaroute Quote  Post ReplyReply Direct Link To This Post Topic: How to resize(cut) text in CXTPTabClientWnd Tab
    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.
Back to Top
hikaroute View Drop Down
Groupie
Groupie


Joined: 05 September 2007
Status: Offline
Points: 51
Post Options Post Options   Thanks (0) Thanks(0)   Quote hikaroute Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
Smucker View Drop Down
Senior Member
Senior Member
Avatar

Joined: 02 February 2008
Status: Offline
Points: 156
Post Options Post Options   Thanks (0) Thanks(0)   Quote Smucker Quote  Post ReplyReply Direct Link To This Post 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;
}

Back to Top
mmh View Drop Down
Newbie
Newbie


Joined: 03 December 2010
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote mmh Quote  Post ReplyReply Direct Link To This Post 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..."
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.047 seconds.