<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : MFC. Edit Control inside RibbonBar.</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Articles and Tutorials : MFC. Edit Control inside RibbonBar.]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 13 May 2026 14:47:35 +0000</pubDate>
  <lastBuildDate>Tue, 15 Mar 2011 02:31:51 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=18057</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[MFC. Edit Control inside RibbonBar. : When Ribbonbar has CXTPControlComboBox...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18057&amp;PID=63313&amp;title=mfc-edit-control-inside-ribbonbar#63313</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 18057<br /><strong>Posted:</strong> 15 March 2011 at 2:31am<br /><br /><br><div>When Ribbonbar has CXTPControlComboBox or CXTPConrtolEdit inside, developer should&nbsp;synchronize&nbsp;its text with internal variable. In this case&nbsp;if user add this Edit control to Quick Access both of them will show same text if user change it.</div><div><br></div><div><img src="uploads/37/EditSampleScreenShot.png" height="270" width="384" border="0" /><br></div><div><br></div><div><br></div><div>Steps</div><div><br></div><div>1. Add Edit to group</div><div><br></div><div>pGroupClipborad-&gt;Add(xtpControlEdit, ID_EDIT_PARAM);</div><div><br></div><div>2. We need add member variable that will hold actual value of Edit - in case we need check edit text, we don't have to find edit and check its current value, we just use this variable directly</div><div><br></div><div>CString m_strParam</div><div>...</div><div><div>m_strParam = _T("Parameter");</div></div><div><br></div><div><br></div><div>3. Add Handler fired when Edit is changed:</div><div><br></div><div><div><span ="Apple-tab-span" style="white-space:pre">	</span>ON_XTP_EXECUTE(ID_EDIT_PARAM, OnEditParam)</div></div><div><br></div><div><div>void CMainFrame::OnEditParam(NMHDR* pNMHDR, LRESULT* pResult)</div><div>{</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;</div><div><span ="Apple-tab-span" style="white-space:pre">	</span></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>CXTPControlEdit* pEdit = DYNAMIC_DOWNCAST(CXTPControlEdit, tagNMCONTROL-&gt;pControl);</div><div><span ="Apple-tab-span" style="white-space:pre">	</span></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>if (pEdit)</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>{</div><div><span ="Apple-tab-span" style="white-space:pre">		</span><b>m_strParam = pEdit-&gt;GetEditText();</b></div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">		</span>// m_strParam contains actual text of edit. don't call GetEditText inside application. just use m_strParam instead.</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">		</span></div><div><span ="Apple-tab-span" style="white-space:pre">		</span>*pResult = TRUE; // Handled</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>}</div><div>}</div></div><div><br></div><div>4. &nbsp;Add Update Handler for our Edit:</div><div><br></div><div><div>void CMainFrame::OnUpdateEditParam(CCmdUI* pCmdUI)</div><div>{</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>CXTPControlEdit* pEdit = <span ="Apple-tab-span" style="white-space:pre">	</span>DYNAMIC_DOWNCAST(CXTPControlEdit, CXTPControl::FromUI(pCmdUI));</div><div><span ="Apple-tab-span" style="white-space:pre">	</span></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>if (pEdit &amp;&amp; !pEdit-&gt;HasFocus())</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>{</div><div><span ="Apple-tab-span" style="white-space:pre">		</span><b>pEdit-&gt;SetEditText(m_strParam);</b></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>}</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>pCmdUI-&gt;Enable(TRUE);</div><div>}</div><div><br></div><div>Now all edit with same&nbsp;ID_EDIT_PARAM id will always&nbsp;show&nbsp;same text</div></div><div><br></div><div><br></div><div>Sample project:</div><div><a href="uploads/37/EditSample.zip" target="_blank">EditSample.zip</a><br></div>]]>
   </description>
   <pubDate>Tue, 15 Mar 2011 02:31:51 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18057&amp;PID=63313&amp;title=mfc-edit-control-inside-ribbonbar#63313</guid>
  </item> 
 </channel>
</rss>