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 » OnUpdateCmdUI's and StateSetTextField Collapse All
Subject Author Date
Daniel Tiedy Dec 4, 2003 - 2:54 PM

I have an CExtCmdItem which is set to StateSetTextField. I assumed I could set the text of the edit field from within a OnUpdateCmdUI using the SetText method. This doesn’t seem to be the correct method for setting the CEdit’s text from within a OnUpdate. Any help would be great.

LAURA GUGLIELMETTI Jan 10, 2012 - 7:30 AM

From a ribbon button OnCommand management I nodified the variable associated to the text.
However the text field is not updated until I move mouse away from the button.
How can I force text to be redrawn ?

Technical Support Jan 12, 2012 - 3:04 AM

The CExtCustomizeSite::RedrawCommandItems() API should be invoked to repaint ribbon items.

LAURA GUGLIELMETTI Jan 10, 2012 - 6:25 AM

Hello,
When I press a ribbon button, I modified the text associated to the control, but the text field is not updated until I move away from the button.
Can you please tell me what do I have to call in order to get the text field automatically updated?

Technical Support Jan 12, 2012 - 3:04 AM

The CExtCustomizeSite::RedrawCommandItems() API should be invoked to repaint ribbon items.

LAURA GUGLIELMETTI Dec 23, 2011 - 7:20 AM

Dear Support-team,
I have some questions regarding edit management inside Ribbon Page.

I’ve created one, but the height is too small, therefore the text is cut.
Moreover I do not understand how to get/set the text inside the EDIT field from code.
Thank you in advance for your kind support.


below you can find the part of code that I used to insert it inside the ribbon


CExtRibbonNodeGroup * pRibbonNode_SearchToolGrp = new CExtRibbonNodeToolGroup( ID_RIBBON_TOOL_1 );
pRibbonGroup->InsertNode( NULL, pRibbonNode_SearchToolGrp );
CExtRibbonNodeGroup * pRibbonNode_SearchToolBefore = new CExtRibbonNodeToolGroup( ID_RIBBON_TOOL_1 );
    pRibbonNode_SearchToolGrp->InsertNode( NULL, pRibbonNode_SearchToolBefore );

CExtRibbonNode * pNodeFirstRecord =
                new CExtRibbonNodeToolButton( IDP_FIRST_PIECE);
pNodeFirstRecord->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’M’) ) ), false );
pNodeFirstRecord->RibbonILE_RuleArrayGet().RemoveAll();
VERIFY( pNodeFirstRecord->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( IDB_FIRST) ) );
pNodeFirstRecord->m_iconSmall.m_bmpNormal.Make32();
pNodeFirstRecord->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pRibbonNode_SearchToolBefore->InsertNode(NULL,pNodeFirstRecord);

CExtRibbonNode * pNodePrevRecord =
                new CExtRibbonNodeToolButton( IDP_PREV_PIECE);
pNodePrevRecord->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_TCHAR( _T(’M’) ) ), false );
pNodePrevRecord->RibbonILE_RuleArrayGet().RemoveAll();
VERIFY( pNodePrevRecord->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( IDB_PREV) ) );
pNodePrevRecord->m_iconSmall.m_bmpNormal.Make32();
pNodePrevRecord->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );
pRibbonNode_SearchToolBefore->InsertNode(NULL,pNodePrevRecord);


CExtRibbonNodeGroup * pRibbonNode_SearchTool2 = new CExtRibbonNodeToolGroup( ID_RIBBON_TOOL_1 );
    pRibbonNode_SearchToolGrp->InsertNode( NULL, pRibbonNode_SearchTool2 );


// CExtRibbonNodeGroup * pRibbonNode_SearchToolGroup =    new CExtRibbonNodeToolGroup( ID_RIBBON_TOOL_1 );
// pRibbonNode_SearchTool->InsertNode(NULL, pRibbonNode_SearchToolGroup);

CExtCustomizeCmdTreeNode * pNodeEditSearch =
new CExtRibbonNode( IDE_PIECE );
    pNodeEditSearch->CmdKeyTipSet( new CExtCustomizeCmdKeyTip( __EXT_MFC_SAFE_LPCTSTR( _T("FF") ) ), false );
    pNodeEditSearch->ModifyFlags( __ECTN_TBB_TEXT_FIELD);
INT nFontNameFieldWidth = g_PaintManager.GetPM()->UiScalingDo( 50, CExtPaintManager::__EUIST_X );
    pNodeEditSearch->TextFieldWidthSet( nFontNameFieldWidth );
pRibbonNode_SearchTool2->InsertNode(NULL, pNodeEditSearch);


Best regards

Daniel Tiedy Dec 5, 2003 - 11:51 AM

From within the OnUpdateCmdUI for my CExtBarTextFieldButton I obtained a pointer to the CExtBarTextFieldButton by using the pCmdUI->m_pOther and the pCmdUI->m_nIndex. From the CExtBarTextFieldButton I call SetFieldText and RedrawButton. This works great, but causes another problem. I can no longer access any menu items because when you click a menu item the OnUpdateCmdUI’s get invoked which causes this particular CExtBarTextFieldButton OnUpdateCmdUI to get envoked which calls SetFieldText which eventually calls CExtCustomizeSite::OnTextFieldInplaceTextSet which cancels any tracked popup menu. Am I going about this correctly?

Technical Support Dec 9, 2003 - 9:09 AM

Dear Daniel,

The CCmdUI::SetText() method can only be used for setting a text string for the menu item. To manage text fields, customized applications should use overridden methods of the CExtCustomizeSite class. To provide any copy of the text field with text data, please override

	virtual void CExtCustomizeSite::OnTextFieldInplaceTextGet(
		const CExtBarTextFieldButton * pTextFieldTBB,
		const CExtCustomizeCmdTreeNode * pNode,
		CExtSafeString & sTextFieldBuffer
		);

To store the result of the edit operation, you should override
	virtual void CExtCustomizeSite::OnTextFieldInplaceTextSet(
		CExtBarTextFieldButton * pTextFieldTBB,
		CExtCustomizeCmdTreeNode * pNode,
		CExtSafeString & sTextFieldBuffer,
		__EXT_MFC_SAFE_LPCTSTR sTextNew
		);

Finally, to verify the text input in the in-place active editor, you may also need to override
	virtual bool CExtCustomizeSite::OnTextFieldVerify(
		CExtBarTextFieldButton * pTextFieldTBB,
		CExtCustomizeCmdTreeNode * pNode,
		__EXT_MFC_SAFE_LPCTSTR sTextOld,
		__EXT_MFC_SAFE_LPCTSTR sTextNew
		);