Print Page | Close Window

Where to capture resizing ???

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Docking Pane
Forum Description: Topics Related to Codejock Docking Pane
URL: http://forum.codejock.com/forum_posts.asp?TID=8835
Printed Date: 28 April 2024 at 9:07pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Where to capture resizing ???
Posted By: amitb
Subject: Where to capture resizing ???
Date Posted: 20 November 2007 at 4:19am
Hello,

I am putting a CXTDockingPane on a CMyDockBar(derived from CXTDockingPaneManager)

After this i am putting a Taskpanel on this Docking pane.

Now when user resizes the pane, i want to handle it.
Which Handler should i be using and for which class ?????




Replies:
Posted By: Oleg
Date Posted: 20 November 2007 at 7:07am
Catch WM_SIZE of Taskpanel.

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


Posted By: amitb
Date Posted: 20 November 2007 at 11:18pm
Thanks Oleg,

Can i store the size of this taskpanel in registry, so that when my application will restart user will see the last size he set.


Posted By: Oleg
Date Posted: 21 November 2007 at 9:05am
Hi,
You have save layout of DockingPanes. See our samples - they show how.


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


Posted By: amitb
Date Posted: 22 November 2007 at 6:32am
Thanks,
I checked the example of how to save the layout.

Now i am geting into another problem
I have class:
class CDockBar : public CXTPDockingPaneManager
{
public:
    CmcTaskPanel    m_wndTaskPanel;
    CXTPDockingPane* m_pDocPane;
    CXTPDockingPaneLayout* m_pCmcLayout;

}

Now in the create function of CDockBar :
I create the taskpanel.
I create the pane
and i attach the taskpane to this pane.

Now when i do this:
    m_pCmcLayout = this->CreateLayout();
    if (m_pCmcLayout->Load(_T("AmitLayout")))
    {
        this->SetLayout(m_pCmcLayout);
    }
    else
    {
        this->GetLayout(m_pCmcLayout);
    }
When before it executes the call to SetLayout, the m_pDocPane shows its class in the Add-Watch of VC6 as {CXTPDockingPane}.
But as soon as the SetLayout calls is executed, the m_pDocPane shows its class in add watch as {CXTPTabManager::CNavigateButtonArrowRight}.
Why the class changes ???


Due to this my application crashes later when i call m_pDocPane->Select(); // In the GetDockingPaneManager() it shows the value of m_pLayout as NULL.


Posted By: Oleg
Date Posted: 23 November 2007 at 1:43am
Yes, after SetLayout call m_pDocPane is destroyed. Don't save pointers. Use FindPane method instead.

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


Posted By: amitb
Date Posted: 26 November 2007 at 5:20am
Hello Oleg,
Using FindPane() Worked fine for me :) Thanks...

Though the problem of the pointer is solved, i am not able to restore the size when i open the application next time.

This is what i am doing. Please tell me if the steps are correct.

In OnCreate()::::

    if (!m_wndTaskPanel.GetSafeHwnd())
    {
        if (!m_wndTaskPanel.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, CRect(0, 0, 0, 0), /*this*/ pWnd, 0))
            return FALSE;
       
        m_wndTaskPanel.SetOwner(pWnd);//this);
       
        m_wndTaskPanel.SetTheme(xtpTaskPanelThemeNativeWinXP);//xtpTaskPanelThemeShortcutBarOffice2003);
        m_wndTaskPanel.SetHotTrackStyle(xtpTaskPanelHighlightImage/*xtpTaskPanelHighlightItem*/);
        m_wndTaskPanel.SetSelectItemOnFocus(TRUE);
        //m_wndTaskPanel.SetSingleSelection();
        m_wndTaskPanel.SetItemLayout(xtpTaskItemLayoutImagesWithText);//xtpTaskItemLayoutImagesWithTextBelow);
        m_wndTaskPanel.AllowDrag(FALSE);   
        m_wndTaskPanel.SetBehaviour(xtpTaskPanelBehaviourList);   
    }

    this->InstallDockingPanes(pWnd);
    this->SetTheme(xtpPaneThemeNativeWinXP/*xtpPaneThemeShortcutBar2003*/);



    m_pDocPane = this->CreatePane(ID_PANE, CRect(0, 0, 150, 150), xtpPaneDockLeft);
    m_pDocPane->SetOptions(xtpPaneNoCloseable | xtpPaneNoHideable | xtpPaneNoFloatable | xtpPaneNoDockable | xtpPaneNoCaption);


    m_pDocPane->Attach(&m_wndTaskPanel);

    m_pCmcLayout = this->CreateLayout();
    if (m_pCmcLayout->Load(_T("AmitLayout")))
    {
        this->SetLayout(m_pCmcLayout);
    }
    else
    {
        this->GetLayout(m_pCmcLayout);
    }
************
Also in the destructor of my class i am doing this:
    m_pCmcLayout->Save(_T("AmitLayout"));
    delete m_pCmcLayout;

Still i am not able to restore the Taskpanel + Pane with the new size....

What is going wrong here ???



Posted By: Oleg
Date Posted: 26 November 2007 at 10:02am

Again you don't need to save pointer to m_pCmcLayout:

 
to save
 
 CXTPDockingPaneLayout layoutNormal(&m_paneManager);
 m_paneManager.GetLayout(&layoutNormal);
 layoutNormal.Save(_T("NormalLayout"));
to load:
 
  // Load the previous state for docking panes.
 CXTPDockingPaneLayout layoutNormal(&m_paneManager);
 if (layoutNormal.Load(_T("NormalLayout")))
 {
  m_paneManager.SetLayout(&layoutNormal);
 }


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


Posted By: amitb
Date Posted: 27 November 2007 at 1:44am
Thanks. I did is without saving as pointer and it works fine.

However, my taskpanel is getting created by the same size.

since before i load the layout  i have a call which is:

m_wndTaskPanel.Create(WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN, CRect(0, 0, 0, 0), /*this*/ pWnd, 0))

this->CreatePane(ID_PANE, CRect(0, 0, 150, 150), xtpPaneDockLeft);
m_pDocPane->Attach(&m_wndTaskPanel);


so due to this the task panel is always getting set to 150,150.



Posted By: amitb
Date Posted: 27 November 2007 at 1:59am
Issue Resolved.

I was creating the pane each time, when actually i should not have created it once the layout was stored in registry.

FindPane() worked.


Posted By: Oleg
Date Posted: 27 November 2007 at 4:56am
ok :)

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



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