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 » CExtCustomizeSite Collapse All
Subject Author Date
Bogdan Munteanu Sep 10, 2011 - 1:35 PM

Hello,

1. I added CExtCustomizeSite to the ProfStudio example. Everything works well if the docking windows are, well, docked... However, if I float one of the windows and then toggle the option "Large icons in toolbars" in the Customize dialog box, the buttons in the floating window don’t change as they should. Do you have any suggestion/workaround for that?

2. CExtCustomizeSite still doesn’t create a dialog box conforming to the GUI scheme.

Thank you,

Bogdan

Technical Support Sep 14, 2011 - 12:50 PM

All the toolbars change icon sizes in our tests. But we suspect inner toolbars inside docked control bars may keep old icon sizes. Please update the source code for this static function:

static void stat_RedrawFloatingFramesEx( CFrameWnd * pDockSite )
{
    ASSERT_VALID( pDockSite );
    struct friend_t : public CExtControlBar
    {
    friend void stat_RedrawFloatingFramesEx( CFrameWnd * pDockSite );
    };
CMap
    <    CMiniFrameWnd *,
        CMiniFrameWnd *,
        char,
        char
        >
    setMiniFrames;
ExtControlBarVector_t vBars;
INT nCountOfExtBars = friend_t::g_AllBars.GetSize();
    for( INT nExtBar = 0; nExtBar < nCountOfExtBars; nExtBar++ )
    {
        CExtControlBar * pControlBar = friend_t::g_AllBars[ nExtBar ];
        ASSERT( pControlBar != NULL );
        if( pControlBar->GetSafeHwnd() == NULL )
            continue;
        ASSERT_VALID( pControlBar );
        ASSERT_KINDOF( CControlBar, pControlBar );
        if( pControlBar->IsDockBar() )
            continue;
        CFrameWnd * pBarParentFrame = pControlBar->GetParentFrame();
        ASSERT_VALID( pBarParentFrame );
        if( pBarParentFrame != pDockSite )
        {
            CMiniFrameWnd * pFloatingFrame =
                DYNAMIC_DOWNCAST(
                    CMiniFrameWnd,
                    pBarParentFrame
                    );
            if( pFloatingFrame == NULL )
                continue;
            setMiniFrames.SetAt( pFloatingFrame, 0 );
        }
        if( pControlBar->m_pDockSite == NULL )
        {
            CExtToolControlBar * pToolBar = DYNAMIC_DOWNCAST( CExtToolControlBar, pControlBar );
            if( pToolBar != NULL )
            {
                CWnd * pWnd = pToolBar->GetParent();
                CRect rc;
                pWnd->GetWindowRect( &rc );
                pWnd->SendMessage( WM_SIZE, SIZE_RESTORED, MAKELPARAM(rc.Width(),rc.Height()) );
                pToolBar->_RecalcPositionsImpl();
            }
        }
    } // for( ; pos != NULL; )
POSITION pos = setMiniFrames.GetStartPosition();
    for( ; pos != NULL; )
    {
        CMiniFrameWnd * pFloatingFrame = NULL;
        char nDummy;
        setMiniFrames.GetNextAssoc(pos,pFloatingFrame,nDummy);
        pFloatingFrame->RecalcLayout();
        pFloatingFrame->RedrawWindow(
            NULL,
            NULL,
            RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE
                | RDW_FRAME | RDW_ALLCHILDREN
            );
    } // for( ; pos != NULL; )
}

It can be included into Prof-UIS. But it’s specific function for specific tasks.

Bogdan Munteanu Sep 14, 2011 - 1:42 PM

This last version addresses all the concerns I had regarding the icon sizes. Thank you so much for your fix.

Technical Support Sep 12, 2011 - 1:37 PM

The CExtCustomizeSite class recomputes the layout only those toolbars which are registered as customizable. The CExtControlBar::stat_RedrawFloatingFrames() static method recomputes the layout of all the floating frame windows. Please override the CExtCustomizeSite::OnChangedToolbarIconSizeOption() virtual method. Your method should invoke the parent class method and CExtControlBar::stat_RedrawFloatingFrames() static method.

The customization dialog is not themed because it should look differently in comparison with main customizable UI elements. It’s also not themed in Microsoft’s applications.

Bogdan Munteanu Sep 12, 2011 - 6:15 PM

Thank you for your quick response.

1. Unfortunately it doesn’t seem to work... I added the following code in Mainfrm.cpp

void
CMainFrame::OnChangedToolbarIconSizeOption ()
{
try
{
CExtCustomizeSite::OnChangedToolbarIconSizeOption();
CExtControlBar::stat_RedrawFloatingFrames(this);
}
catch(...)
{
}
}

and

    virtual void
OnChangedToolbarIconSizeOption ();

in MainFrm.h.
The method is being called (I stepped through it) but neither the floating dialog box nor the dialog box docked at the bottom of the main frame (with no other control above it) do not seem to adjust their buttons.
However, if I resize them manually afterwards, they redraw correctly (with big buttons).

I sent you an email with the snapshots of my tests. Is there anything I could do to help solving this problem?

2. Your argument regarding the look-and-feel of the Customize dialog box is fair enough: thank you for looking into it.

Technical Support Sep 13, 2011 - 1:01 PM

We confirm your task requires an improved version of the CExtControlBar::stat_RedrawFloatingFrames() method:

static void stat_RedrawFloatingFramesEx( CFrameWnd * pDockSite )
{
    ASSERT_VALID( pDockSite );
    struct friend_t : public CExtControlBar
    {
    friend void stat_RedrawFloatingFramesEx( CFrameWnd * pDockSite );
    };
CMap
    <    CMiniFrameWnd *,
        CMiniFrameWnd *,
        char,
        char
        >
    setMiniFrames;
ExtControlBarVector_t vBars;
INT nCountOfExtBars = friend_t::g_AllBars.GetSize();
    for( INT nExtBar = 0; nExtBar < nCountOfExtBars; nExtBar++ )
    {
        CExtControlBar * pControlBar = friend_t::g_AllBars[ nExtBar ];
        ASSERT( pControlBar != NULL );
        if( pControlBar->GetSafeHwnd() == NULL )
            continue;
        ASSERT_VALID( pControlBar );
        ASSERT_KINDOF( CControlBar, pControlBar );
        if( pControlBar->IsDockBar() )
            continue;
        CFrameWnd * pBarParentFrame = pControlBar->GetParentFrame();
        ASSERT_VALID( pBarParentFrame );
        if( pBarParentFrame == pDockSite )
            continue;
        CMiniFrameWnd * pFloatingFrame =
            DYNAMIC_DOWNCAST(
                CMiniFrameWnd,
                pBarParentFrame
                );
        if( pFloatingFrame == NULL )
            continue;
        setMiniFrames.SetAt( pFloatingFrame, 0 );
        if( pControlBar->m_pDockSite == NULL )
        {
            CExtToolControlBar * pToolBar = DYNAMIC_DOWNCAST( CExtToolControlBar, pControlBar );
            if( pToolBar != NULL )
            {
                CWnd * pWnd = pToolBar->GetParent();
                CRect rc;
                pWnd->GetWindowRect( &rc );
                pWnd->SendMessage( WM_SIZE, SIZE_RESTORED, MAKELPARAM(rc.Width(),rc.Height()) );
                pToolBar->_RecalcPositionsImpl();
            }
        }
    } // for( ; pos != NULL; )
POSITION pos = setMiniFrames.GetStartPosition();
    for( ; pos != NULL; )
    {
        CMiniFrameWnd * pFloatingFrame = NULL;
        char nDummy;
        setMiniFrames.GetNextAssoc(pos,pFloatingFrame,nDummy);
        pFloatingFrame->RecalcLayout();
        pFloatingFrame->RedrawWindow(
            NULL,
            NULL,
            RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE
                | RDW_FRAME | RDW_ALLCHILDREN
            );
    } // for( ; pos != NULL; )
}

Bogdan Munteanu Sep 14, 2011 - 5:57 AM

The floating resizable dialog boxes work now, thank you. Do you plan to add this function to the next release?

Unfortunately, the buttons of the dialog box docked at the bottom of the main frame (with nothing above) still do not change. See also the email I sent yesterday with a sample snapshot.

Bogdan

Bogdan Munteanu Sep 10, 2011 - 2:15 PM

I am afraid the problem is slightly larger than expected: consider again the ProfStudio example to which one adds CExtCustomizeSite. I close all docking windows and all toolbars then I open lets say the Solution Explorer docking window and I dock it to the bottom of the main frame: now if I start toggling the button size in the Customize dialog box nothing happens. This is because no sizing or position changed message is sent to the Solution Explorer window and therefore the buttons stay unchanged until one resizes the main frame.

Bogdan Munteanu Sep 10, 2011 - 1:48 PM

I forgot to mention that if I resize the floating window after closing the Customize dialog box, the size of the buttons is changed correctly. This makes me believe that the button-related notification is not propagated correctly while switching the button option.

Thx,
Bogdan