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 » RibbonBar: request for border arround listbox in file options dialog for quick access bar Collapse All
Subject Author Date
Oliver Rau Mar 2, 2010 - 2:19 AM

Dear ProfUIS-Team,

the options dialog for the quick access bar of the RibbonBarMDI sample application has a listbox container where you can add controls. No matter what theme you select there is no border around this container, something that can be kind of puzzling for some users, especially if the container is empty ("...oooh, I have trash, but where is the garbage can?" ;-).


Sure, this depends on personal taste and habit, but we have some requests to add a border. What would be the best way to do this?

Best regards,

Martin

Technical Support Mar 10, 2010 - 2:23 PM

We removed list box borders by customer requests. These borders can be returned back easily. Just comment the following lines of code in the CExtRibbonOptionsPageCustomizeQATB::OnInitDialog() method:

   m_listBoxChooseCommandsFrom.m_rcNcsbCustomNcAreaSizes.SetRect( 0, 0, 0, 0 );
            m_listBoxCustomizeTarget.m_rcNcsbCustomNcAreaSizes.SetRect( 0, 0, 0, 0 );
            m_listBoxChooseCommandsFrom.m_clrNcsbCustomNcAreaFill = RGB( 0, 0, 0 );
            m_listBoxCustomizeTarget.m_clrNcsbCustomNcAreaFill = RGB( 0, 0, 0 );
            m_listBoxChooseCommandsFrom.ModifyStyle( WS_BORDER, 0, SWP_FRAMECHANGED );
            m_listBoxCustomizeTarget.ModifyStyle( WS_BORDER, 0, SWP_FRAMECHANGED );
            m_listBoxChooseCommandsFrom.ModifyStyleEx( WS_EX_STATICEDGE|WS_EX_CLIENTEDGE|WS_EX_DLGMODALFRAME, 0, SWP_FRAMECHANGED );
            m_listBoxCustomizeTarget.ModifyStyleEx( WS_EX_STATICEDGE|WS_EX_CLIENTEDGE|WS_EX_DLGMODALFRAME, 0, SWP_FRAMECHANGED );

We can simply make the border removing optional.

Oliver Rau Mar 11, 2010 - 5:02 AM

Yes, that’s it - thank you very much!!!

Oliver Rau Mar 5, 2010 - 8:17 AM

Sorry again - quick link but wrong image ... here’s the correct one:


Technical Support Mar 5, 2010 - 10:24 AM

We added the following local class in scope of the CExtRibbonOptionsPage class declaration:

   class __PROF_UIS_API CSimpleCommandsListBox : public CExtNCSB < CExtWFF < CExtCustomizeCommandListBox > >
            {
            protected:
                        bool _IsDisabledBackground() const
                        {
                                    ASSERT_VALID( this );
                                    ASSERT( GetSafeHwnd() != NULL );
                                    if( GetCount() != 0 )
                                                return false;
                                    return true;
                        }
                        void _DrawDisabledBackground( CDC & dc )
                        {
                                    ASSERT_VALID( this );
                                    ASSERT( GetSafeHwnd() != NULL );
                                    ASSERT( dc.GetSafeHdc() != NULL );
                                    CRect rc;
                                    GetClientRect( &rc );
                                    dc.FillSolidRect( &rc, ::GetSysColor( COLOR_3DFACE ) );
                        }
                        virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
                        {
                                    switch( message )
                                    {
                                    case WM_PAINT:
                                                if( _IsDisabledBackground() )
                                                {
                                                            CPaintDC dc( this );
                                                            _DrawDisabledBackground( dc );
                                                            return 0;
                                                }
                                    break;
                                    case WM_ERASEBKGND:
                                    case WM_PRINT:
                                    case WM_PRINTCLIENT:
                                                if( _IsDisabledBackground() )
                                                {
                                                            _DrawDisabledBackground( * ( CDC::FromHandle( (HDC) wParam ) ) );
                                                            return 1L;
                                                }
                                    break;
                                    }
                                    LRESULT lResult = CExtNCSB < CExtWFF < CExtCustomizeCommandListBox > > :: WindowProc( message, wParam, lParam );
                                    switch( message )
                                    {
                                    case LB_ADDSTRING:
                                    case LB_INSERTSTRING:
                                    case LB_DELETESTRING:
                                    case LB_SETCOUNT:
                                                Invalidate();
                                                UpdateWindow();
                                    break;
                                    }
                                    return lResult;
                        }
            };

Then we replaced the following two properties of the CExtRibbonOptionsPageCustomizeQATB class:
   CExtNCSB < CExtWFF < CExtCustomizeCommandListBox > > m_listBoxChooseCommandsFrom;
            CExtNCSB < CExtWFF < CExtCustomizeCommandListBox > > m_listBoxCustomizeTarget;

With the following:
   CSimpleCommandsListBox m_listBoxChooseCommandsFrom;
            CSimpleCommandsListBox m_listBoxCustomizeTarget;

Now the empty list boxes without borders become recognizable. Please let us know your point of view.

Oliver Rau Mar 9, 2010 - 12:26 AM

Thank you for the modification!


Unfortunately we got the following compile error on template instantiation:



Error    2    error C2661: ’CExtWFF<CExtWFFBase>::CExtWFF’ : no overloaded function takes 2 arguments    d:\Prof-UIS\Include\ExtScrollWnd.h    451
... with the following output:

 

[...]

1>ExtPaintManager.cpp 1>d:\Prof-UIS\Include\ExtScrollWnd.h(451) : error C2661: ’CExtWFF<CExtWFFBase>::CExtWFF’ : no overloaded function takes 2 arguments 1>     with 1>     [ 1>     CExtWFFBase=CExtCustomizeCommandListBox 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(425) : while compiling class template member function ’CExtNCSB_Impl<_BTNCSBimpl>::CExtNCSB_Impl(UINT,CWnd *,bool,bool)’ 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(1183) : see reference to class template instantiation ’CExtNCSB_Impl<_BTNCSBimpl>’ being compiled 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtRibbonBar.h(2237) : see reference to class template instantiation ’CExtNCSB<_BTNCSB>’ being compiled 1>     with 1>     [ 1>     _BTNCSB=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>ExtPaintManager2.cpp 1>d:\Prof-UIS\Include\ExtScrollWnd.h(451) : error C2661: ’CExtWFF<CExtWFFBase>::CExtWFF’ : no overloaded function takes 2 arguments 1>     with 1>     [ 1>     CExtWFFBase=CExtCustomizeCommandListBox 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(425) : while compiling class template member function ’CExtNCSB_Impl<_BTNCSBimpl>::CExtNCSB_Impl(UINT,CWnd *,bool,bool)’ 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(1183) : see reference to class template instantiation ’CExtNCSB_Impl<_BTNCSBimpl>’ being compiled 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtRibbonBar.h(2237) : see reference to class template instantiation ’CExtNCSB<_BTNCSB>’ being compiled 1>     with 1>     [ 1>     _BTNCSB=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>ExtPopupCtrlMenu.cpp 1>d:\Prof-UIS\Include\ExtScrollWnd.h(451) : error C2661: ’CExtWFF<CExtWFFBase>::CExtWFF’ : no overloaded function takes 2 arguments 1>     with 1>     [ 1>     CExtWFFBase=CExtCustomizeCommandListBox 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(425) : while compiling class template member function ’CExtNCSB_Impl<_BTNCSBimpl>::CExtNCSB_Impl(UINT,CWnd *,bool,bool)’ 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(1183) : see reference to class template instantiation ’CExtNCSB_Impl<_BTNCSBimpl>’ being compiled 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtRibbonBar.h(2237) : see reference to class template instantiation ’CExtNCSB<_BTNCSB>’ being compiled 1>     with 1>     [ 1>     _BTNCSB=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>ExtPopupMenuWnd.cpp 1>   Prof-UIS is automatically linking with winmm.lib 1>   (Windows Multimedia System) 1>d:\Prof-UIS\Include\ExtScrollWnd.h(451) : error C2661: ’CExtWFF<CExtWFFBase>::CExtWFF’ : no overloaded function takes 2 arguments 1>     with 1>     [ 1>     CExtWFFBase=CExtCustomizeCommandListBox 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(425) : while compiling class template member function ’CExtNCSB_Impl<_BTNCSBimpl>::CExtNCSB_Impl(UINT,CWnd *,bool,bool)’ 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(1183) : see reference to class template instantiation ’CExtNCSB_Impl<_BTNCSBimpl>’ being compiled 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtRibbonBar.h(2237) : see reference to class template instantiation ’CExtNCSB<_BTNCSB>’ being compiled 1>     with 1>     [ 1>     _BTNCSB=CExtWFF<CExtCustomizeCommandListBox> 1>     ]

[...]

1>extribbonbar.cpp 1>d:\Prof-UIS\Include\ExtScrollWnd.h(451) : error C2661: ’CExtWFF<CExtWFFBase>::CExtWFF’ : no overloaded function takes 2 arguments 1>     with 1>     [ 1>     CExtWFFBase=CExtCustomizeCommandListBox 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(425) : while compiling class template member function ’CExtNCSB_Impl<_BTNCSBimpl>::CExtNCSB_Impl(UINT,CWnd *,bool,bool)’ 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(1183) : see reference to class template instantiation ’CExtNCSB_Impl<_BTNCSBimpl>’ being compiled 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtRibbonBar.h(2237) : see reference to class template instantiation ’CExtNCSB<_BTNCSB>’ being compiled 1>     with 1>     [ 1>     _BTNCSB=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>ExtToolControlBar.cpp 1>d:\Prof-UIS\Include\ExtScrollWnd.h(451) : error C2661: ’CExtWFF<CExtWFFBase>::CExtWFF’ : no overloaded function takes 2 arguments 1>     with 1>     [ 1>     CExtWFFBase=CExtCustomizeCommandListBox 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(425) : while compiling class template member function ’CExtNCSB_Impl<_BTNCSBimpl>::CExtNCSB_Impl(UINT,CWnd *,bool,bool)’ 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtScrollWnd.h(1183) : see reference to class template instantiation ’CExtNCSB_Impl<_BTNCSBimpl>’ being compiled 1>     with 1>     [ 1>     _BTNCSBimpl=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>     d:\Prof-UIS\Include\ExtRibbonBar.h(2237) : see reference to class template instantiation ’CExtNCSB<_BTNCSB>’ being compiled 1>     with 1>     [ 1>     _BTNCSB=CExtWFF<CExtCustomizeCommandListBox> 1>     ] 1>Generating Code... 1>Build log was saved at "file://d:\Prof-UIS\Bin_800\UnicodeDebug\ProfUISDLL\BuildLog.htm" 1>ProfUISDLL - 6 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Could this be specific for our version of ProfUIS (2.87)? Or are we just missing some specific constructor, declaration ...?


Best regards,


Martin

Technical Support Mar 9, 2010 - 11:17 AM

The problem was with the class. We are sorry for this inconvenience. Let’s try it again:

   class __PROF_UIS_API CSimpleFlockerFreeListBox : public CExtWFF < CExtCustomizeCommandListBox >
            {
            public:
                        CSimpleFlockerFreeListBox() { }
                        CSimpleFlockerFreeListBox( UINT nIDTemplate, CWnd * pParentWnd ) { nIDTemplate; pParentWnd; }
                        CSimpleFlockerFreeListBox( __EXT_MFC_SAFE_LPCTSTR lpszTemplateName, CWnd * pParentWnd ) { lpszTemplateName; pParentWnd; }
            };

            class __PROF_UIS_API CSimpleCommandsListBoxBase : public CExtNCSB < CSimpleFlockerFreeListBox >
            {
            public:
                        CSimpleCommandsListBoxBase() : CExtNCSB < CSimpleFlockerFreeListBox > ( true ) { }
            };

            class __PROF_UIS_API CSimpleCommandsListBox : public CSimpleCommandsListBoxBase
            {
            protected:
                        bool _IsDisabledBackground() const
                        {
                                    ASSERT_VALID( this );
                                    ASSERT( GetSafeHwnd() != NULL );
                                    if( GetCount() != 0 )
                                                return false;
                                    return true;
                        }
                        void _DrawDisabledBackground( CDC & dc )
                        {
                                    ASSERT_VALID( this );
                                    ASSERT( GetSafeHwnd() != NULL );
                                    ASSERT( dc.GetSafeHdc() != NULL );
                                    CRect rc;
                                    GetClientRect( &rc );
                                    dc.FillSolidRect( &rc, ::GetSysColor( COLOR_3DFACE ) );
                        }
                        virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
                        {
                                    switch( message )
                                    {
                                    case WM_PAINT:
                                                if( _IsDisabledBackground() )
                                                {
                                                            CPaintDC dc( this );
                                                            _DrawDisabledBackground( dc );
                                                            return 0;
                                                }
                                    break;
                                    case WM_ERASEBKGND:
                                    case WM_PRINT:
                                    case WM_PRINTCLIENT:
                                                if( _IsDisabledBackground() )
                                                {
                                                            _DrawDisabledBackground( * ( CDC::FromHandle( (HDC) wParam ) ) );
                                                            return 1L;
                                                }
                                    break;
                                    }
                                    LRESULT lResult = CSimpleCommandsListBoxBase::WindowProc( message, wParam, lParam );
                                    switch( message )
                                    {
                                    case LB_ADDSTRING:
                                    case LB_INSERTSTRING:
                                    case LB_DELETESTRING:
                                    case LB_SETCOUNT:
                                                Invalidate();
                                                UpdateWindow();
                                    break;
                                    }
                                    return lResult;
                        }
            };

Oliver Rau Mar 10, 2010 - 7:47 AM

Thank you for this modified approach, but ...


... even if I’m running into danger to steal your precious time, I’d like to illustrate our real concern.


This is the current look (since v2.83):



And this is the previous v2.82 look (the one our customers have got accustomed with):



The 2.82 look comes close to that of Word2007 - and for some of our customers this is the main argument besides the accustomization effect.


After some experiments based on your approach we achieved the following look with 2.87:



As it is difficult and error prone to wilder in foreign code we are now facing some problems like repainting the frame on resize events (it gets hidden by the parent backgound redraw) etc. etc.


So my request (regarding only the listbox frames): would it be possible to achieve this ’old-fashioned’ 2.82 look somehow? (Please, don’t kill me for this ;-) ... )


Best regards,


Martin

Oliver Rau Mar 5, 2010 - 4:14 AM

But for an empty list box there is no frame border visible. Any chance to make it visible?


Screenshot QAB


Martin

Oliver Rau Mar 5, 2010 - 8:06 AM

Sorry for the bad link. Here is the quicker one:


Technical Support Mar 2, 2010 - 10:24 AM

Both the ribbon bar gallery list box and selected dialog page on the ribbon options dialog have a thing border:

http://www.prof-uis.com/download/forums/tmp/RibbonBarOptionsDialog.png