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 General Discussion » Starting up with default dialog bar sizes Collapse All
Subject Author Date
Olaf Baeyens Mar 19, 2003 - 3:24 AM

I still have implementation questions how te create control bars with the size of the dialog bar as default the very first time you start up te program.

The problem is that this way the sizes are about 10 pixels short and the framework behaves strange.

I have this:

In my CMainFrame class I have this:

CExtControlBar m_wndLightsBarDlg;
CExtWRB<CLightsDlg> m_wndLightsDialog;

Then in CMainFrame::OnCreate() I do this:

        //--- Lights properties dialog box
    if(    !m_wndLightsBarDlg.Create(_T("Lights colour and position"),this,ID_VIEW_LIGHTSPROPERTIES)){
        TRACE0("Failed to create m_wndBar3\n");
        return -1;        // fail to create
    }


    if( !m_wndLightsDialog.Create(IDD_LIGHTS,&m_wndLightsBarDlg))    {
        TRACE0("Failed to create m_wndBarDlg\n");
        return -1;        // fail to create
    }

    m_wndLightsBarDlg.EnableDocking(CBRS_ORIENT_VERT);

    //--- Activate docking functionality
    if( !CExtControlBar::FrameEnableDocking(this))    {
        ASSERT( FALSE );
        return -1;
    }

    if( !CExtControlBar::FrameInjectAutoHideAreas(this)){
        ASSERT( FALSE );
        return -1;
    }

m_wndLightsDialog.GetClientRect(Rect);
    Size.cx=Rect.right-Rect.left;
    Size.cy=Rect.top-Rect.bottom;
    m_wndLightsBarDlg.SetInitDesiredSizeVertical(Size);
    m_wndLightsBarDlg.SetInitDesiredSizeHorizontal(Size);
    m_wndLightsBarDlg.SetInitDesiredSizeFloating(Size);
    m_wndLightsDialog.ShowSizeGrip(TRUE);

    m_wndLightsBarDlg.DockControlBar(AFX_IDW_DOCKBAR_LEFT, 1, this, false);
    m_wndLightsBarDlg.AutoHideModeSet( true, false, false, true );

    CExtControlBar::ProfileBarStateLoad(
        this,
        pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        pApp->m_pszProfileName,
        &m_dataFrameWP
        );
    g_CmdManager->SerializeState(
        pApp->m_pszProfileName,
        pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        false
        );

    //--- Set these commands to be always active
    VERIFY(
        g_CmdManager->SetBasicCommands(pApp->m_pszProfileName,g_statBasicCommands,TRUE)
        );








Sergiy Lavrynenko Mar 21, 2003 - 12:24 AM

Dear Olaf,

Your code is correct, but you should add sizes of resizable bar’s separator and caption to your Size variable before call m_wndLightsBarDlg.SetInitDesiredXXXXX(Size).

Hear are rules for calculating these sizes:

min(4,GetSystemMetrics(SM_CXSIZEFRAME)) – vertical separator width (you should add this to your Size.cx)

min(4,GetSystemMetrics(SM_CYSIZEFRAME)) – horizontal separator height

GetSystemMetrics(SM_CXSMCAPTION)+1+( min(4,GetSystemMetrics(SM_CXSIZEFRAME))) – minimal width of vertically docked bar

GetSystemMetrics(SM_CYSMCAPTION)+1+(min(4,GetSystemMetrics(SM_CYSIZEFRAME))) – minimal height of vertically docked bar (you should add this to your Size.cy)

Best regards,
Sergiy.

Olaf Baeyens Mar 21, 2003 - 1:15 AM

It is working! :-)

Now only one small problem left.
It appears if I have two dynamic dialog boxes minimized at the right side bar, then I select one, and fix it, then I select the other one and fix it, the second one connects to the first one but with a small offset to the right.... Clicking on the bar makes it jumps to the correct placne and then it seem that it works normal.

I also discovered that if I select the second and then the first, then sometimes the most left dialog box (fixed) is not painted, just the dialogbox-gray.

Any tips for this?

It is a very good framework in my opinion. :-)

Sergiy Lavrynenko Mar 21, 2003 - 2:23 AM

Dear Olaf,

It seems I have caught what you mean but I cannot help you until I do not have your test project. Please send it to me so that I can look into the problem and find the appropriate solution.

Best regards,
Sergiy.

Olaf Baeyens Mar 21, 2003 - 2:36 AM

The problem seems to have dissapeared with the updat you have sent me.

I will keep you posted...