|
|
|
|
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.
Subject |
Author |
Date |
|
chen xinyu
|
Dec 19, 2009 - 11:43 PM
|
Hi: I want to show some news in my Ribbon Bar, just liking CEdit works is ok. How can I do that? Thank you!
|
|
Technical Support
|
Dec 22, 2009 - 5:21 AM
|
You should create your CExtBarTextFieldButton -derived class which implements the CExtBarTextFieldButton::RibbonILV_CalcSize() virtual method for computing custom size of text field and the CExtBarTextFieldButton::OnInplaceControlCreate() virtual method for creating the multi-line in-pace editor control (just invoke parent class method and add the ES_MULTILINE style to the created by default editor window). This method can return NULL if you want to make text field non-editable. You should also implement the CExtBarTextFieldButton::PaintCompound() virtual method for painting multi-line text in the text field because by default text fields are single line. Next step is to create your own ribbon node which instantiates the multiline text field button:
class __PROF_UIS_API CYourNewsRibbonNode : public CExtRibbonNode
{
public:
DECLARE_SERIAL( CYourNewsRibbonNode );
CYourNewsRibbonNode(
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)
);
virtual ~CYourNewsRibbonNode();
virtual CRuntimeClass * _OnRibbonGetButtonRTC();
}
The _OnRibbonGetButtonRTC() method should simply return the RUNTIME_CLASS of your text field button. Now you can use the CYourNewsRibbonNode class in your ribbon command tree and it will instantiate the multiline text field.
|
|