![]() |
How to reorder CXTPTabClientWnd tabs by code? |
Post Reply
|
| Author | |
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Topic: How to reorder CXTPTabClientWnd tabs by code?Posted: 14 May 2008 at 4:29pm |
|
Hi,
does anybody know how to reorder CXTPTabClientWnd tabs by code?
In detail: I want to sort the opened documents by name.
|
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
mgampi
Senior Member
Joined: 14 July 2003 Status: Offline Points: 1210 |
Post Options
Thanks(0)
Quote Reply
Posted: 19 May 2008 at 11:16am |
|
Hi;
for anyone who's interrested in this; the solution is to derive from CXTPTabClientWnd and add a sort function that removes all items and afterwards add them again in sorted order:
void CXRSortableTabClientWnd::Sort() {
// Get the set of all opened MDI client windows std::set<CMDIChildWnd*> clients; xrApp->GetMDIClientMap(clients); // Insert the set into a multimap sorted by document title std::multimap<_tstring, CMDIChildWnd*> sorted; for (std::set<CMDIChildWnd*>::const_iterator i=clients.begin(); i!=clients.end(); ++i) { CString strItem=GetItemText(*i); sorted.insert(std::make_pair(_tstring(strItem), *i)); } m_bLockReposition = TRUE;
// Remove all current tab items
m_pActiveWorkspace->DeleteAllItems(); XTPWorkspaceNewTabPosition position=GetNewTabPositon();
SetNewTabPosition(xtpWorkspaceNewTabRightMost); // Add tab items in a sorted manner
for (std::multimap<_tstring, CMDIChildWnd*>::const_iterator i=sorted.begin();i!=sorted.end(); ++i) { CXTPTabManagerItem* pFoundItem = AddItem(i->second); pFoundItem->SetHandle(i->second->GetSafeHwnd()); } m_bLockReposition = FALSE;
SetNewTabPosition(position);
Reposition(); } |
|
|
Martin Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0 Platform: Windows 10 v 22H2 (64bit) Language: VC++ 2022 |
|
![]() |
|
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 |