<?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 : Attaching to a CWnd pSite does not work</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Attaching to a CWnd pSite does not work]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 13 May 2026 13:18:08 +0000</pubDate>
  <lastBuildDate>Thu, 04 Nov 2004 02:52:17 +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=1364</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[Attaching to a CWnd pSite does not work : Hi Oleg,  I googled this forum...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1364&amp;PID=3831&amp;title=attaching-to-a-cwnd-psite-does-not-work#3831</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=719">fredwobus</a><br /><strong>Subject:</strong> 1364<br /><strong>Posted:</strong> 04 November 2004 at 2:52am<br /><br />Hi Oleg,<br><br>I googled this forum and found some help in the article https://forum.codejock.com/forum_posts.asp?TID=489 "<span style="font-weight: bold;">Topic: Paint UI with mix of themes</span>"<br><br>Although apparently unrelated it does offer a crucial piece of adivice - "<span style="font-weight: bold;"> try to call pCommadnBars-&gt;SetSite()</span> "<br><br>I now got the DynamicPopups sample to work without the initialisation for the CMainFrm.<br><br>The commandbars now work within the CDynamicPopupsView like so:<br>The red code is normally done by InitCommandBars() in a FrameWnd. As IdonÄt have one here (just a CDialog) that never got called, and thecommand bar didn't have the correct pSite pointer to send its XTP_xxmessages to.<br><br><br><br>void CDynamicPopupsView::OnInitialUpdate()<br>{<br>&nbsp;&nbsp;&nbsp; CFormView::OnInitialUpdate();<br>&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 0, 0);">CXTPCommandBars* pCommandBars = CXTPCommandBars::CreateCommandBars();</span><br><br>&nbsp;&nbsp;&nbsp; m_pToolBar = new CXTPToolBar();<br>&nbsp;&nbsp;&nbsp;  m_pToolBar-&gt;CreateToolBar(WS_VISIBLE|WS_CHILD|CBRS_TOOLTI PS, this);<br>&nbsp;&nbsp;&nbsp; m_pToolBar-&gt;LoadToolBar(IDR_TOOLBAR_EXT);<br><br>&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 0, 0);">m_pToolBar-&gt;SetCommandBars(pCommandBars);</span><br>&nbsp;&nbsp;&nbsp; <span style="color: rgb(255, 0, 0);">pCommandBars-&gt;SetSite(this);</span><br><br><br>&nbsp;&nbsp;&nbsp;  m_pToolBar-&gt;GetControls()-&gt;Remove(m_pToolBar-&gt;GetCo ntrol(0));<br>&nbsp;&nbsp;&nbsp; CXTPControl* pControl = m_pToolBar-&gt;GetControls()-&gt;Add(xtpControlButtonPopup,<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; ID_BUTTON_POPUP, _T(""), 0);<br>&nbsp;&nbsp;&nbsp; pControl-&gt;SetFlags(xtpFlagManualUpdate);<br><br><br>&nbsp;&nbsp;&nbsp; ResizeParentToFit();<br>&nbsp;&nbsp;&nbsp; m_wndList.AddString(_T("Undo Edit"));<br>&nbsp;&nbsp;&nbsp; m_wndList.AddString(_T("Undo Resize"));<br>}<br><br><br><br>Cheers, Fred.<br><br>]]>
   </description>
   <pubDate>Thu, 04 Nov 2004 02:52:17 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1364&amp;PID=3831&amp;title=attaching-to-a-cwnd-psite-does-not-work#3831</guid>
  </item> 
  <item>
   <title><![CDATA[Attaching to a CWnd pSite does not work :  Yes I have a correct message...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1364&amp;PID=3826&amp;title=attaching-to-a-cwnd-psite-does-not-work#3826</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=719">fredwobus</a><br /><strong>Subject:</strong> 1364<br /><strong>Posted:</strong> 03 November 2004 at 9:57am<br /><br />Yes I have a correct message handler for ON_XTP_CREATECONTROL in CDynamicPopupsView.<br><br>It only works if the menu is loaded by the OnCreateControl in CMainFrm.<br>Try again and but remove the ON_XTP_CREATECONTROL() macro from the message map in CMainFrm.<br>The button popup in the CDynamicPopupsView window should now show the &#091;Undo&#093; menu.<br>It never shows the menu assembled in CControlUndo::OnCalcDynamicSize, because the<br>CControlUndo class is never instantiated for that popup.<br>The handler CDynamicPopupsView::OnCreateControl&nbsp; is never calledfor (lpCreateControl-&gt;nID == ID_BUTTON_UNDO). Therefore we do not get thechance to insert our own control class.<br><br>Cheers,<br><br>Fred<br><br><span style="font-size:10px"><br /><br />Edited by fredwobus</span>]]>
   </description>
   <pubDate>Wed, 03 Nov 2004 09:57:22 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1364&amp;PID=3826&amp;title=attaching-to-a-cwnd-psite-does-not-work#3826</guid>
  </item> 
  <item>
   <title><![CDATA[Attaching to a CWnd pSite does not work : I made all same and it works. May...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1364&amp;PID=3823&amp;title=attaching-to-a-cwnd-psite-does-not-work#3823</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 1364<br /><strong>Posted:</strong> 03 November 2004 at 9:01am<br /><br /><P>I made all same and it works.</P><P>May be you forget to add ON_XTP_CREATECONTROL() macro to message map? <IMG src="http://forum.codejock.com/smileys/smiley2.gif" border="0"></P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Wed, 03 Nov 2004 09:01:57 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1364&amp;PID=3823&amp;title=attaching-to-a-cwnd-psite-does-not-work#3823</guid>
  </item> 
  <item>
   <title><![CDATA[Attaching to a CWnd pSite does not work : Hi,  In my application I need...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=1364&amp;PID=3821&amp;title=attaching-to-a-cwnd-psite-does-not-work#3821</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=719">fredwobus</a><br /><strong>Subject:</strong> 1364<br /><strong>Posted:</strong> 03 November 2004 at 7:38am<br /><br />Hi,<br><br>In my application I need a toolbar (with codejock-style flashylook&amp;feel), which isn't docked to a CMainFrm or any other FrameWnd,but simply fixed inside the window of a dialog.<br>The toolbar should be permanently docked to the window just like the toolbar in the CHeroesView of the Common\Advanced sample.<br><br>I am trying to adapt the <span style="font-weight: bold;">DynamicPopups </span>sample to my needs (using Xtreme Toolkit 9.51)<br><br>I want the undo toolbar to be shown in  the CDynamicPopupsView instead of it being docked to the CMainFrm.<br>Modifying the sample, the toolbar is created inCDynamicPopupsView::OnInitialUpdate() and moved into position in&nbsp;CDynamicPopupsView::OnSize() using CalcDockingLayout() - (just likeCHeroesView::OnSize from the Advanced Sample).<br><span style="font-weight: bold;">The OnCreateControl method also moved from the CMainFrm class to the CDynamicPopupsView class.</span><br><br>The toolbar is created and in the right place, the Add and Removebuttons work, but the "Undo popup" button ID_BUTTON_POPUP does notbehave correctly.<br>The OnCreateControl method is not called for the ID_BUTTON_UNDO control, which creates the custom CControlUndo control.<br>Therefore the button pops up a default menu with one disabled entry &#091;Undo&#093; (just like the default in the RC file.<br><br>Investigating the problem I found the difference in behaviour inCXTPControls::AddMenuItem (XTPControls.cpp:117). That is the placewhere the pSite is determined to which the WM_XTP_CREATECONTROL messageis sent.<br><br>In my modified application the <span style="font-weight: bold;">WM_XTP_CREATECONTROL</span>message is not sent to my CDynamicPopupsView (which has a handler forit creating the custom CControlUndo control), but to some differentwindow, where it does nothing.<br><br><br>If you read this far, you can imagine what I am asking - <span style="font-weight: bold;">How do I make sure my commandbar gets a valid pSite, which receives its messages such as WM_XTP_CREATECONTROL ????</span><br><br>Note, that I create the toolbar in CDynamicPopupsView::OnInitialUpdate() using the this pointer as the pParentWnd.<br><br><br>If you need my example project or any more code or info, let me know.<br><br>Thanks, <br>&nbsp;&nbsp; Fred<br><br><br>]]>
   </description>
   <pubDate>Wed, 03 Nov 2004 07:38:19 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=1364&amp;PID=3821&amp;title=attaching-to-a-cwnd-psite-does-not-work#3821</guid>
  </item> 
 </channel>
</rss>