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 » Never got answer Collapse All
Subject Author Date
tera tera Jan 27, 2009 - 5:07 PM
Technical Support Jan 29, 2009 - 12:47 PM

We failed reproduce the sticking menu problem. We checked both XP and Vista.

If you need custom ribbon buttons, you should implement two C++ classes. The first is a CExtBarButton-derived class which implements the CExtBarButton::CalculateLayout() and CExtBarButton::PaintCompound() virtual methods.

class CYourBarButton : public CExtBarButton
{
public:
            DECLARE_DYNCREATE( CYourBarButton );
            CYourBarButton( CExtToolControlBar * pBar = NULL, UINT nCmdID = ID_SEPARATOR, UINT nStyle = 0 )
                        : CExtBarButton( pBar,  nCmdID, nStyle )
            {
            }
            virtual CSize CalculateLayout( CDC & dc, CSize sizePreCalc, BOOL bHorz )
            {
                        . . .
            }
            virtual void PaintCompound( CDC & dc, bool bPaintParentChain, bool bPaintChildren, bool bPaintOneNearestChildrenLevelOnly )
            {
                        if( ! IsPaintAble( dc ) )
                                    return;
                        if( AnimationClient_StatePaint( dc ) )
                                    return;
                        if( bPaintParentChain )
                                    PaintParentChain( dc );
                        . . .
            }
};

IMPLEMENT_DYNCREATE( CYourBarButton, CExtBarButton )
The second is a CExtRibbonNode-derived class which should be used in ribbon tree and which creates your CYourBarButton button instance:
class CYourRibbonNode : public CExtRibbonNode
{
public:
            DECLARE_SERIAL( CYourRibbonNode );
            CYourRibbonNode(
                        UINT nCmdIdBasic = 0L, UINT nCmdIdEffective = 0L, CExtRibbonNode * pParentNode = NULL, DWORD dwFlags = 0L,
                        __EXT_MFC_SAFE_LPCTSTR strTextInToolbar = NULL, __EXT_MFC_SAFE_LPCTSTR strTextInMenu = NULL, __EXT_MFC_SAFE_LPCTSTR strTextUser = NULL,
                        LPARAM lParam = 0L, CExtCmdIcon * pIconCustomized = NULL
#if (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
                        , INT nTextFieldWidth = 100,
                        INT nDropDownWidth = -2, // (-1) - auto calc, (-2) - same as button area
                        INT nDropDownHeightMax = 250
#endif // (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
                        )
                        : CExtRibbonNode (
                                    nCmdIdBasic, nCmdIdEffective, pParentNode, dwFlags, strTextInToolbar, strTextInMenu, strTextUser, lParam, pIconCustomized
#if (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
                                    , nTextFieldWidth, nDropDownWidth, nDropDownHeightMax
#endif // (!defined __EXT_MFC_NO_BUILTIN_TEXTFIELD)
                        )
            {
            }
            CYourRibbonNode(
                        CYourRibbonNode & other
                        )
                        : CExtRibbonNode( other )
            {
            }
            virtual CRuntimeClass * _OnRibbonGetButtonRTC()
            {
                        return ( RUNTIME_CLASS( CYourBarButton ) );
            }
};

IMPLEMENT_SERIAL( CYourRibbonNode, CExtRibbonNode, VERSIONABLE_SCHEMA|1 );

Technical Support Jan 28, 2009 - 12:29 PM

We confirm the problem with ribbon menu can be reproduced with Prof-UIS 2.83 but not with 2.84. The inner layout of ribbon button discussed in the second message can be regarded as a feature request.


tera tera Jan 28, 2009 - 5:18 PM

Hello.


>We confirm the problem with ribbon menu can be reproduced with Prof-UIS 2.83 but not with 2.84.

A bug is over even 2.85.


>The inner layout of ribbon button discussed in the second message can be regarded as a feature request.


If you like.

Please teach the virtual function that I seem to be able to customize.