Print Page | Close Window

Code to move tabs in CXTPTabClientWnd?

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=2050
Printed Date: 13 July 2025 at 8:55am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Code to move tabs in CXTPTabClientWnd?
Posted By: Ark42
Subject: Code to move tabs in CXTPTabClientWnd?
Date 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()



Replies:
Posted By: Oleg
Date Posted: 30 March 2005 at 8:30am
Did you tried

OnWorkspaceCommand?

 

try

OnWorkspaceCommand(XTP_ID_WORKSAPCE_NEWVERTICAL);

OnWorkspaceCommand(XTP_ID_WORKSAPCE_MOVEPREVIOUS);



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Ark42
Date Posted: 30 March 2005 at 10:41am

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.



Posted By: Ark42
Date Posted: 31 March 2005 at 6:12pm
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?



Posted By: Oleg
Date Posted: 06 April 2005 at 4:56am

Yes, we changed it to protected.

Thank you!



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: maxjock
Date Posted: 20 April 2005 at 7:33am

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.



Posted By: Oleg
Date Posted: 21 April 2005 at 11:20pm
Please, wait 9.70. We are preparing it now.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: maxjock
Date Posted: 25 April 2005 at 2:48am
I am working under pressure and I need to know when 9.70 will be released.

Thanks again.



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