<?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 : Problem Responding  CXTPControlCustom Button Click</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Problem Responding  CXTPControlCustom Button Click]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 13 Jun 2026 13:22:58 +0000</pubDate>
  <lastBuildDate>Sun, 05 Sep 2010 19:55:49 +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=17144</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[Problem Responding  CXTPControlCustom Button Click : After a while I figured this out...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17144&amp;PID=60065&amp;title=problem-responding-cxtpcontrolcustom-button-click#60065</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3241">tommyvee</a><br /><strong>Subject:</strong> 17144<br /><strong>Posted:</strong> 05 September 2010 at 7:55pm<br /><br />After a while I figured this out by wandering through the samples. To respond to a click on a  CXTPControlCustom control, you need to use a MESSAGE_MAP defined in your custom control with an ON_CONTROL_REFLECT macro like,<br />ON_CONTROL_REFLECTION(BN_CLICKED, OnTVButtonClicked).<br /><br />I am not sure why direct ON_COMMAND() macros in MainFrame.cpp message map do not work for CXTPControlCustom controls, but they don't and following the sample is not too hard. I would still like to understand why the messaging works this way.]]>
   </description>
   <pubDate>Sun, 05 Sep 2010 19:55:49 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17144&amp;PID=60065&amp;title=problem-responding-cxtpcontrolcustom-button-click#60065</guid>
  </item> 
  <item>
   <title><![CDATA[Problem Responding  CXTPControlCustom Button Click : I am updating an application that...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17144&amp;PID=59866&amp;title=problem-responding-cxtpcontrolcustom-button-click#59866</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3241">tommyvee</a><br /><strong>Subject:</strong> 17144<br /><strong>Posted:</strong> 23 August 2010 at 1:56am<br /><br /><P>I am updating an application that used a much older version of the CodeJock libraries.</P><DIV>The application has a complicated class that is derived from CButton used in a toolbar, so I would like to just use this class with CXTPControlCustom.</DIV><DIV>While the toolbar buttons appear fine, there is no response when they are clicked. </DIV><DIV>&nbsp;</DIV><DIV>So I modified the Samples\CommandBars\CommonControls sample to add a CButton to the CommandBar using CXTPControlCustom to try to understand the problem. I am unable to get any action out of clicking the CXTPControlCustom CButton in the modified sample, either.</DIV><DIV>&nbsp;</DIV><DIV>Seems like I am missing something obvious and I hope some CodeJock experts can help out.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Here is the code from the modified sample application, where I create the custom control.</DIV><DIV>&nbsp;</DIV><DIV><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>int</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)</DIV><P>{</P></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>&nbsp; int</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> iID = lpCreateControl-&gt;nID;</P><DIV></DIV><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas><P>&nbsp; // Create the Button control</P></FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>&nbsp; if</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> (lpCreateControl-&gt;nID == ID_TVTOOLBAR_BMP2)</P><P>&nbsp; {</P><P></FONT></FONT><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas>&nbsp;&nbsp;&nbsp;&nbsp; // Get the ID of the control currently being created</P></FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P>&nbsp;&nbsp;&nbsp; UINT nID = lpCreateControl-&gt;nID;</P><P></P><P>&nbsp;&nbsp;&nbsp; m_wndTVButton1.Create(</FONT></FONT><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas>"TVButton1"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>,WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,</P><P>&nbsp;&nbsp;&nbsp; CRect(0, 0, 70, 20), </FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>this</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>, ID_TVTOOLBAR_BMP2);</P><P>&nbsp;&nbsp;&nbsp; m_wndTVButton1.SetFocus();</P><P></FONT></FONT><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas>&nbsp;&nbsp;&nbsp; // Use m_wndTVButton1 to create a CXTPControlCustom* control</P></FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P>&nbsp;&nbsp;&nbsp; CXTPControlCustom* pCustomButton = CXTPControlCustom::CreateControlCustom(&amp;m_wndTVButton1);</P><P></FONT></FONT><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas>&nbsp;&nbsp;&nbsp; // Set the ID of the custom control to the ID of the radio button</P></FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P>&nbsp;&nbsp;&nbsp; pCustomButton-&gt;SetID(nID);</P><P>&nbsp;&nbsp;&nbsp; lpCreateControl-&gt;pControl = pCustomButton;</P><P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>&nbsp;&nbsp;&nbsp; return</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> TRUE;</P><P>&nbsp; }</P><DIV></DIV><P>Here is the code from the MESSAGE_MAP where I tried to catch the button click event (I tried various methods, none worked).</P><DIV></DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P>ON_COMMAND(ID_TVTOOLBAR_BMP2, OnTVButtonClicked)</P><P>ON_BN_CLICKED(ID_TVTOOLBAR_BMP2,OnTVButtonClicked)</P><P>ON_XTP_EXECUTE(ID_TVTOOLBAR_BMP2, OnTVButtonExecute)</P><DIV></DIV><DIV></DIV>and the simple functions that never get called are below.<DIV>&nbsp;</DIV><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><P>void</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> CMainFrame::OnTVButtonClicked()</P><P>{</P><P>&nbsp;&nbsp; AfxMessageBox(</FONT></FONT><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas>"TV Button Clicked Msg"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>}</P></FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><P>void</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> CMainFrame::OnTVButtonExecute(NMHDR *pNMHDR,LRESULT *pResult)</P><P>{</P><P>&nbsp;&nbsp; AfxMessageBox(</FONT></FONT><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas>"TV Button Clicked Execute Msg"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>}</P><DIV></DIV><P>Thanks for the help,</P><DIV></DIV>Tom</FONT></FONT></FONT></FONT></FONT></FONT></FONT></FONT>]]>
   </description>
   <pubDate>Mon, 23 Aug 2010 01:56:32 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17144&amp;PID=59866&amp;title=problem-responding-cxtpcontrolcustom-button-click#59866</guid>
  </item> 
 </channel>
</rss>