Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Dragging ControlBar raises assert Collapse All
Subject Author Date
Suhai Gyorgy Jun 2, 2006 - 7:29 AM

Dear Support,

We just upgraded from Prof-UIS v2.52 to v2.54 (VS 2003, WinXP). In our application we have some controlbars initially hidden in tabbed-container + floating mode. This worked fine before. But now after upgrading, when I show any of the controlbars
1. it appears in very-very small size in the upper-left corner of my screen and
2. when I try to drag it, it asserts in DockMarkerBase class.

My code:

MainFrm.h:

CExtControlBar *m_pCB1;
CExtControlBar *m_pCB2;
CExtControlBar *m_pCB3;


MainFrm.cpp (in OnCreate):

...
HICON hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_CB1), IMAGE_ICON, 16, 16, 0);
ASSERT( hIcon != NULL );
CExtCmdIcon iconCB1;
iconCB1.AssignFromHICON( hIcon, true );
g_CmdManager->CmdSetIcon(g_CmdManager->ProfileNameFromWnd(GetSafeHwnd()), ID_VIEW_CB1, &iconCB1, false);
m_pCB1 = new CExtControlBar;
m_pCB1->Create(NULL, this, ID_VIEW_CB1);
if(!m_pCB1 ) {
    TRACE0("Failed to create m_pCB1\n");
    return -1;        // fail to create
}
m_pCB1->EnableDocking(CBRS_ALIGN_ANY);
m_pCB1->SetInitDesiredSizeFloating( CSize( 200, 250 ) );
...
//same for m_pCB2 and m_pCB3
...
if( !CExtControlBar::ProfileBarStateLoad(...))
{
    ShowControlBar(m_pCB1, false, false);
    ShowControlBar(m_pCB2, false, false);
    ShowControlBar(m_pCB3, false, false);

    m_pCB1->FloatControlBar();
    m_pCB1->DockControlBarIntoTabbedContainer(m_pCB2, -1, this, false);
    m_pCB2->DockControlBarIntoTabbedContainer(m_pCB1, -1, this, false);
    m_pCB1->DockControlBarIntoTabbedContainer(m_pCB3, -1, this, false);
}


Call Stack:

    MyProg.exe!CExtPaintManager::DockMarkerBase::CreateFromBitmapResources(CRect rcScreen={...}, CExtPaintManager::eDockMarkerType_t eDockMarkerType=__EDMT_2005_TOP, unsigned long clrTransparentIn=65280, const unsigned short * strResourceBmpIn=0x000076b8, const unsigned short * strResourceBmpOut=0x000076b8, const unsigned short * strResourceTypeBmpIn=0x00000002, const unsigned short * strResourceTypeBmpOut=0x00000002, HINSTANCE__ * hInstBmpIn=0x00000000, HINSTANCE__ * hInstBmpOut=0x00000000) Line 29430 + 0x1c    C++
    MyProg.exe!CExtPaintManager::DockMarkerBeta2::Create(bool bCentralMode=false, CExtPaintManager::eDockMarkerType_t eDockMarkerType=__EDMT_2005_TOP, CRect rcScreen={...}) Line 30204 + 0x41    C++
    MyProg.exe!CExtPaintManager::DockMarkerBase::Create(bool bCentralMode=false, CExtPaintManager::eDockMarkerType_t eDockMarkerType=__EDMT_2005_GROUP_SPARSED, CRect rcScreen={...}) Line 30028 + 0x2f    C++
    MyProg.exe!CExtPaintManager::DockMarker_CreateWnds(HWND__ * hWndLastDynamicTarget=0x00000000, CExtPaintManager::eDockMarkerType_t eDockMarkerType=__EDMT_2005_GROUP_SPARSED, CRect rcScreen={...}, CTypedPtrArray<CPtrArray,CExtDynDockMarkerWnd *> & arrDockMarkerWnds={...}) Line 30543 + 0x2a    C++
    MyProg.exe!CExtDynDockMarkerWnd::CreateOuterMarkers(CFrameWnd * pFrame=0x014e0068, bool bShow=false, CExtPaintManager * pPM=0x0102fd60) Line 20977 + 0x41    C++
>    MyProg.exe!CExtControlBar::_DraggingStart(const CPoint & point={...}, const CPoint & pointOffset={...}, CSize sizeWaitMouseMove={...}) Line 10568 + 0x30    C++
    MyProg.exe!CExtMiniDockFrameWnd::OnNcLButtonDown(unsigned int nHitTest=2, CPoint point={...}) Line 369 + 0xac    C++


I see there is a DockMarkerBeta2 class or structure... could that be only a beta version and maybe this is a bug?

Thank you for your help,
Chris.

Technical Support Jun 2, 2006 - 9:36 AM

1. Please make sure that you are using the SetInitDesiredSizeFloating(), SetInitDesiredSizeVertical() and SetInitDesiredSizeHorizontal() methods of the CExtControlBar class to specify the initial size of the control bars in the floating, docked vertically and docked horizontally states.

2. The problem relates to failure of loading resources. Please check that you included the following line in your *.rc2 file:

#if ( !(defined _AFXDLL && !defined __STATPROFUIS_WITH_DLLMFC__) )
    #include <Resources/Resource.rc>
#endif
You can read more about this issue in the FAQ How to link statically with Prof-UIS?.

Suhai Gyorgy Jun 2, 2006 - 4:40 PM

I did both of those... even v2.52 wouldn’t have worked without the 2nd.
I emitted the SetInitDesiredSizeHorizontal() and SetInitDesiredSizeVertical() here on forum only because I thought that has nothing to do with the problem, but in my real prog I call those too for all controlbars.

Any other possibility?

Thank you,
Chris

Technical Support Jun 5, 2006 - 1:01 PM

We think gave you the correct answer. We can review your code if you send it to us. The entire project would be preferable, but the main frame’ source code is enough.

Suhai Gyorgy Jun 6, 2006 - 2:16 AM

I’m really sorry, it was my fault... I added my last post without having the code in front of me, but I remembered seeing those 3 lines in .rc2 file.... Well, yes, they were there but commented! So I did put them in there at some point but commented them for some reason. Anyways, now dragging is working nicely as before.

But I still have the other problem: Control bar appears in very small size.

I’ll post all code concerning creation of control bars... every control bar is created exactly the same way:

.h:

CExtControlBar *m_pCB1;
CListCtrl m_wndDockedCtrl1;

.cpp (OnCreate):

HICON hIcon = (HICON)::LoadImage(::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_CB1), IMAGE_ICON, 16, 16, 0);
ASSERT( hIcon != NULL );
CExtCmdIcon iconCB1;
iconCB1.AssignFromHICON( hIcon, true );
g_CmdManager->CmdSetIcon(g_CmdManager->ProfileNameFromWnd(GetSafeHwnd()), ID_VIEW_CB1, &iconCB1, false);
m_pCB1 = new CExtControlBar;
m_pCB1->Create(NULL, this, ID_VIEW_CB1);
if(!m_pCB1 ) {
TRACE0("Failed to create m_pCB1\n");
return -1; // fail to create
}
m_pCB1->EnableDocking(CBRS_ALIGN_ANY);
m_pCB1->SetInitDesiredSizeVertical( CSize( 160, 160 ) );
m_pCB1->SetInitDesiredSizeHorizontal( CSize( 160, 160 ) );
m_pCB1->SetInitDesiredSizeFloating( CSize( 160, 160 ) );
m_pCB1->SetWindowText(_T("My Control Bar1"));
if( !m_wndDockedCtrl1.Create(WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_HSCROLL|LVS_LIST, CRect(0,0,0,0), m_pCB1, m_pCB1->GetDlgCtrlID())
    || !( (new CThinFrameWnd)->CreateDynamicThinFrame(&m_wndDockedCtrl1))) {
        return -1;        // fail to create
    }
m_wndDockedCtrl1.SetFont(CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)));



CThinFrameWnd class is derived from CWnd and I got that from one of your samples to create a thin frame around controls.

Both our project and MainFrame are quite big, but if this plus information can’t help, I’ll try to create a small sample representing the problem.

Thank you very much:
Chris


Technical Support Jun 6, 2006 - 10:53 AM

Your code is absolutely correct, but it simply creates the control bar and the list. The control bar’s position is initialized outside this code. We need to take a look at the entire CMainFrame::OnCreate() method or at its part which docks all the control bars.

Suhai Gyorgy Jun 6, 2006 - 12:26 PM

The docking part of the code looks as I already stated it in the first post of this thread:

if( !CExtControlBar::ProfileBarStateLoad(...))
{
ShowControlBar(m_pCB1, false, false);
ShowControlBar(m_pCB2, false, false);
ShowControlBar(m_pCB3, false, false);

m_pCB1->FloatControlBar();
m_pCB1->DockControlBarIntoTabbedContainer(m_pCB2, -1, this, false);
m_pCB2->DockControlBarIntoTabbedContainer(m_pCB1, -1, this, false);
m_pCB1->DockControlBarIntoTabbedContainer(m_pCB3, -1, this, false);
}

Surely at first program startup all control bars are invisible. But when I activate any of the control bars, it appears in a very small size. Also if I resize the control bar, hide it, close program, open it up again and activating control bar again, it is again in that very small size. I’m sure I save the state in DestroyWindow, because position of control bar is saved, but size is not.

Thank you: Chris

Technical Support Jun 7, 2006 - 9:57 AM

The problem will be fixed if you hide your bars at the final stage:

//ShowControlBar(m_pCB1, false, false);
//ShowControlBar(m_pCB2, false, false);
//ShowControlBar(m_pCB3, false, false);

m_pCB1->FloatControlBar();
m_pCB1->DockControlBarIntoTabbedContainer(m_pCB2, -1, this, false);
m_pCB2->DockControlBarIntoTabbedContainer(m_pCB1, -1, this, false);
m_pCB1->DockControlBarIntoTabbedContainer(m_pCB3, -1, this, false);

ShowControlBar(m_pCB1, false, false);
ShowControlBar(m_pCB2, false, false);
ShowControlBar(m_pCB3, false, false);
We confirm that tthis will make the bars visible for a short time, but only when the application starts for the first time. The problem can be solved on client machines if the control bar state in the registry is initialized by the installer. We can also spend some time and provide you with the updated code which allows you to dock invisible floating bars.

Suhai Gyorgy Jun 8, 2006 - 1:19 AM

Problem still persists. If I start application for the first time, I see the bars appearing and then disappearing, application is up and running... I close application, start it again right away, and then activating (showing) any of the control bars from menu.... Control bar appears in small size again.

Thank you: Chris.

Technical Support Jun 8, 2006 - 4:47 AM

We sent you a modified version of your test project. The problem discussed in this thread can be solved using the CSufraceHider class implemented in the project. It should be used during the initial docking of all the bars.