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 |
|
Francesco Toscano
|
Apr 25, 2014 - 12:35 PM
|
Dear support, I have a RibbonBar (CExtRibbonBar), where I need to reduce the default distance that exist between a Label control and an Edit Control (... placed in one line). I tried to follow what you suggested at:http://www.prof-uis.com/prof-uis/tech-support/general-forum/in-one-line-label-and-editbox-with-ribbon-66282.aspx#@lt;/p>
But I really not able to release it. It is not clear to me the realation that exist with the custom class derived from "CExtRibbonNodeLabel" that I have to release and the "CExtRibbonButtonGroup", which includes the method "CExtRibbonButtonGroup::OnRibbonGetOuterGroupDistance()" that should be implemented.
Could you please show me a sample code that demonstrates how I can release it? I am really going crazy! Thanks!
|
|
Francesco Toscano
|
May 8, 2014 - 7:54 AM
|
Great! That’s exactly what I was searching for !!!!!!!! Many thanks Art. Regards
|
|
Art Wilkes
|
May 7, 2014 - 9:10 AM
|
A simple mode to control distance between 2 ribbon buttons:
class CExtRibbonButtonToolGroupEx : public CExtRibbonButtonToolGroup { public: DECLARE_DYNCREATE(CExtRibbonButtonToolGroupEx); CExtRibbonButtonToolGroupEx( CExtRibbonPage * pBar = NULL, UINT nCmdID = ID_SEPARATOR, UINT nStyle = 0 ) : CExtRibbonButtonToolGroup(pBar, nCmdID, nStyle) {
} virtual INT OnRibbonGetOuterGroupDistance( bool bDistanceBefore ) const { INT nDistance = __super::OnRibbonGetOuterGroupDistance(bDistanceBefore); return bDistanceBefore ? nDistance : 30;
} }; // class CExtRibbonButtonToolGroupEx
IMPLEMENT_DYNCREATE(CExtRibbonButtonToolGroupEx, CExtRibbonButtonToolGroup);
class CExtRibbonNodeToolGroupEx : public CExtRibbonNodeToolGroup { public: DECLARE_SERIAL(CExtRibbonNodeToolGroupEx); CExtRibbonNodeToolGroupEx( UINT nCmdIdBasic = 0L, CExtRibbonNode * pParentNode = NULL, DWORD dwFlags = 0L, __EXT_MFC_SAFE_LPCTSTR strTextInToolbar = NULL, LPARAM lParam = 0L ) : CExtRibbonNodeToolGroup(nCmdIdBasic, pParentNode, dwFlags, strTextInToolbar, lParam) {
} virtual CRuntimeClass * _OnRibbonGetButtonRTC() { return (RUNTIME_CLASS(CExtRibbonButtonToolGroupEx)); } }; // class CExtRibbonNodeToolGroupEx
IMPLEMENT_SERIAL(CExtRibbonNodeToolGroupEx, CExtRibbonNodeToolGroup, VERSIONABLE_SCHEMA | 1);
CExtRibbonNode * CMainFrame::_InitRibbonNode_Home_Clipboard() { ……………………………………………………..
CExtRibbonNodeGroup * pRibbonNode_LabelEdit = new CExtRibbonNodeToolGroup(123); pRibbonGroup->InsertNode(NULL, pRibbonNode_LabelEdit); { CExtRibbonNodeGroup * pRibbonNode_LabelEdit2 = new CExtRibbonNodeToolGroupEx(123); pRibbonNode_LabelEdit->InsertNode(NULL, pRibbonNode_LabelEdit2); CExtCustomizeCmdTreeNode * pNodeIndentLabel = new CExtRibbonNodeLabel(123, NULL, 0, _T("Test")); pRibbonNode_LabelEdit2->InsertNode(NULL, pNodeIndentLabel); } { CExtRibbonNodeGroup * pRibbonNode_LabelEdit2 = new CExtRibbonNodeToolGroup(123); pRibbonNode_LabelEdit->InsertNode(NULL, pRibbonNode_LabelEdit2); CExtCustomizeCmdTreeNode * pTestTextField = new CExtRibbonNode(123); pTestTextField->ModifyFlags(__ECTN_TBB_TEXT_FIELD); INT nFontNameFieldWidth = g_PaintManager.GetPM()->UiScalingDo(143, CExtPaintManager::__EUIST_X); pTestTextField->TextFieldWidthSet(nFontNameFieldWidth); pRibbonNode_LabelEdit2->InsertNode(NULL, pTestTextField); }
…………………………………………………….. }
|
|
Francesco Toscano
|
May 6, 2014 - 11:21 AM
|
Dear Art, I already use the same code with my ribbon controls (with the excpetion that I use a fixed value with the method TextFieldWidthSet) and anyway, the one you posted doesn’t permit to control the distance between the ribbon buttons. What I am trying to do (without any luck), it is to use the "CExtRibbonButtonGroup::OnRibbonGetOuterGroupDistance" virtual method with my own CExtRibbonNodeButton -derived class in order to specifically control the distance value of each button. Your forum link (http://www.prof-uis.com/prof-uis/tech-support/general-forum/in-one-line-label-and-editbox-with-ribbon-66282.aspx) reports that this is possible to implement it, but not a sample on how to release it effectively. I tried to follow what your support team suggested with the above link, but it is not clear to me how implement the CExtRibbonButtonGroup::OnRibbonGetOuterGroupDistance() with my custom CExtRibbonNodeButton-derived class. That’s it! I really hope to receive a reply about this. Regards
|
|
Art Wilkes
|
May 5, 2014 - 9:37 AM
|
Try this code and let me know if it works for you solution.
CExtRibbonNodeGroup * pRibbonNode_LabelEdit = new CExtRibbonNodeToolGroup(123); pRibbonGroup->InsertNode(NULL, pRibbonNode_LabelEdit); CExtCustomizeCmdTreeNode * pNodeIndentLabel = new CExtRibbonNodeLabel(123, NULL, 0, _T("Test")); pRibbonNode_LabelEdit->InsertNode(NULL, pNodeIndentLabel); CExtCustomizeCmdTreeNode * pTestTextField = new CExtRibbonNode(123); pTestTextField->ModifyFlags(__ECTN_TBB_TEXT_FIELD); INT nFontNameFieldWidth = g_PaintManager.GetPM()->UiScalingDo(143, CExtPaintManager::__EUIST_X); pTestTextField->TextFieldWidthSet(nFontNameFieldWidth); pRibbonNode_LabelEdit->InsertNode(NULL, pTestTextField);
Prof-UIS Support
|
|