Code to move tabs in CXTPTabClientWnd? |
Post Reply |
Author | |
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
Posted: 30 March 2005 at 12:26am |
Is it possible to move tabs and create new workspaces with CXTPTabClientWnd (groups are enabled) using just code? I want to create two child windows (maybe, they could exist already) and put them in two different tab group workspaces. I need to create workspaces if there is less than two, and put the two newly created windows into the last two tab groups (if the user has created more than two of them). I can't seem to see a way. I am trying to derive from CXTPTabClientWnd but many things are private such as DoWorkspaceCommand() Edited by Ark42 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Did you tried
OnWorkspaceCommand?
try OnWorkspaceCommand(XTP_ID_WORKSAPCE_NEWVERTICAL); OnWorkspaceCommand(XTP_ID_WORKSAPCE_MOVEPREVIOUS); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Yes but MOVEPREVIOUS/MOVENEXT don't help when I need to move to a specific workspace. Also, NEWVERTICAL and many other MTI related stuff doesn't work if I wrap my code with: ::SendMessage(m_hWndMDIClient, WM_SETREDRAW, FALSE, 0); //create and/or move child windows and/or workspaces ::SendMessage(m_hWndMDIClient, WM_SETREDRAW, TRUE, 0); ::RedrawWindow(m_hWndMDIClient, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN | RDW_FRAME); In order to prevent flickering. |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Here are the functions I added to my derived class that I felt were useful for programmatically moving windows around in the workspaces:
I did have to put DoWorkspaceCommand() as protected instead of private so that I could use it. int MyCXTPTabClientWndDerivedClass::GetActiveWorkspace(void) { return GetWndWorkspace(MDIGetActive()); } int MyCXTPTabClientWndDerivedClass::GetWndWorkspace(CWnd *pWnd) { if( !pWnd ) { return -1; } CXTPTabManagerItem* pItem = FindItem(pWnd->m_hWnd); if( !pItem ) { return -1; } return FindIndex(pItem->GetTabManager()); } void MyCXTPTabClientWndDerivedClass::MoveWndToWorkspace(CWnd *pWnd, int nNum) { CXTPTabManagerItem *pItem = FindItem(pWnd->GetSafeHwnd()); if( pItem != NULL ) { int nCount = GetWorkspaceCount(); if( nNum < nCount ) { CWorkspace *pDest = GetWorkspace(nNum); if( pDest != pItem->GetTabManager() ) { DoWorkspaceCommand(pItem, pDest, ACTION_ATTACH); } } else { DoWorkspaceCommand(pItem, GetWorkspace(nCount - 1), ACTION_INSERTVERT); } } } void MyCXTPTabClientWndDerivedClass::EnsureTabVisible(CWnd *pWnd) { CXTPTabManagerItem *pItem = FindItem(pWnd->GetSafeHwnd()); if( pItem != NULL ) { pItem->GetTabManager()->EnsureVisible(pItem); } } Do you think DoWorkspaceCommand() could become protected instead in the next release so I can continue to use these functions? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Yes, we changed it to protected. Thank you! |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
maxjock
Newbie Joined: 20 April 2005 Location: Romania Status: Offline Points: 2 |
Post Options
Thanks(0)
|
I use Xtreme Toolkit Pro v9.60 - 30 days trial version to build a demo application so that my boss could take the decision to buy your library. I need to do exactly what Ark42 want to do, but I don't have a licence (and the source code of the library). I tried OnWorkspaceCommand(XTP_ID_WORKSAPCE_NEWVERTICAL); but it doesn't work. I can not use a class like MyCXTPTabClientWndDerivedClass because ACTION_ATTACH and ACTION_INSERTVERT are not defined and of course DoWorkspaceCommand is private. Tell me if there is any workaround. Many thanks in advance. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Please, wait 9.70. We are preparing it now.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
maxjock
Newbie Joined: 20 April 2005 Location: Romania Status: Offline Points: 2 |
Post Options
Thanks(0)
|
I am working under pressure and I need to know when 9.70 will be released.
Thanks again. |
|
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 |