![]() |
How to resize(cut) text in CXTPTabClientWnd Tab |
Post Reply ![]() |
Author | |
hikaroute ![]() Groupie ![]() Joined: 05 September 2007 Status: Offline Points: 51 |
![]() ![]() ![]() ![]() ![]() 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.
|
|
![]() |
|
hikaroute ![]() Groupie ![]() Joined: 05 September 2007 Status: Offline Points: 51 |
![]() ![]() ![]() ![]() ![]() |
hi, don't have anyone who know how to fix my problem? And oleg, can you help me?
|
|
![]() |
|
Smucker ![]() Senior Member ![]() ![]() Joined: 02 February 2008 Status: Offline Points: 156 |
![]() ![]() ![]() ![]() ![]() |
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; } |
|
![]() |
|
mmh ![]() Newbie ![]() Joined: 03 December 2010 Status: Offline Points: 3 |
![]() ![]() ![]() ![]() ![]() |
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..."
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |