<?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 : Find PopupControl</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Find PopupControl]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 02 May 2026 18:51:37 +0000</pubDate>
  <lastBuildDate>Fri, 18 May 2007 09:55:45 +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=7168</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[Find PopupControl : I looker into your sample, if...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23036&amp;title=find-popupcontrol#23036</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1813">Paolo</a><br /><strong>Subject:</strong> 7168<br /><strong>Posted:</strong> 18 May 2007 at 9:55am<br /><br />I looker into your sample, if I'm not wrong you're somewhat "hard-coding" a link between PopupControl button and its children.<br>Let me to explain: all children button set a boolean variable named "m_nOptionID" and parent PopupControl is updated by checking the value of m_nOptionID. By using your m_nOptionID variable I would be forced to create a variable for each set PopupControl-children and this is somewhat difficult to me as these toolbars are created from external source and I should create a non predefined number of variables and link all dynamically created buttons to their own variable.<br><br>I think I'll solve this problem by using a STL::map to associate PopupControl and its children while dynamically creating them.<br><br>2) In your reply you said me "Never use FindControl if your application supports customization". My previous code was just part of my application, and some cheks may have been omitted to make code block shorter. If I do check control_p to be non NULL would it be correct to use FindControl? If not, which is the correct way to get a Control pointer given its ID?<br><br>Thanks for help. Paolo<br>]]>
   </description>
   <pubDate>Fri, 18 May 2007 09:55:45 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23036&amp;title=find-popupcontrol#23036</guid>
  </item> 
  <item>
   <title><![CDATA[Find PopupControl : My previous request is based on...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23034&amp;title=find-popupcontrol#23034</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2110">Source</a><br /><strong>Subject:</strong> 7168<br /><strong>Posted:</strong> 18 May 2007 at 7:23am<br /><br />My previous request is based on the following example:<br><br>Dim Control As CommandBarControl, ControlFile As CommandBarPopup<br>&nbsp;&nbsp;&nbsp; <br>Set ControlFile = cmdBarraPrincipal.ActiveMenuBar.Controls.Add(xtpControlPopup, ID_APP, ID_APP_DESC, -1, False)<br>&nbsp;&nbsp;&nbsp; With ControlFile.CommandBar.Controls<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Set Control = .Add(xtpControlButton, ID_APP_ACESSO, ID_APP_ACESSO_DESC)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Control.BeginGroup = True<br>&nbsp;&nbsp;&nbsp; End With<br><br>ID_APP = 100 in a const public declaration variable<br>ID_APP = 101 in a const public declaration variable<br><br>Using cmdBarraPrincipal.FindControl(, 100).Enabled = False I can change itīs state, but...<br><br>for the popup control 101 (ID_APP_ACESSO) this does not work!<br><br>Can you please help.<br>Regards.<br>Carlos Neves<br>]]>
   </description>
   <pubDate>Fri, 18 May 2007 07:23:44 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23034&amp;title=find-popupcontrol#23034</guid>
  </item> 
  <item>
   <title><![CDATA[Find PopupControl : Can you please send this example...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23033&amp;title=find-popupcontrol#23033</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2110">Source</a><br /><strong>Subject:</strong> 7168<br /><strong>Posted:</strong> 18 May 2007 at 7:08am<br /><br />Can you please send this example in vbasic ?<br>Regards.<br>]]>
   </description>
   <pubDate>Fri, 18 May 2007 07:08:34 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23033&amp;title=find-popupcontrol#23033</guid>
  </item> 
  <item>
   <title><![CDATA[Find PopupControl : Hi,  Never use FindControl if...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23025&amp;title=find-popupcontrol#23025</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 7168<br /><strong>Posted:</strong> 18 May 2007 at 5:58am<br /><br /><DIV>Hi,</DIV><DIV>&nbsp;</DIV><DIV>Never use FindControl if your application supports customization - user can delete/copy control and your FindControl will return 0; </DIV><DIV>&nbsp;</DIV><DIV>Here sample how it can work:</DIV><DIV><a href="https://forum.codejock.com/uploads/20070518_055809_SplitSample.zip" target="_blank">SplitSample.zip</A></DIV>]]>
   </description>
   <pubDate>Fri, 18 May 2007 05:58:31 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23025&amp;title=find-popupcontrol#23025</guid>
  </item> 
  <item>
   <title><![CDATA[Find PopupControl : I create a CXTPPopupToolBar instance...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23002&amp;title=find-popupcontrol#23002</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1813">Paolo</a><br /><strong>Subject:</strong> 7168<br /><strong>Posted:</strong> 17 May 2007 at 11:15am<br /><br />I create a CXTPPopupToolBar instance and set it as TearOffPopup.<br>I create a CXTPControlPopup instance and set its CommandBar to be the CXTPPopupToolBar instance that was previously created.<br>I create a CXTPControl instance (a CXTPControlButton instance) and add it to the CXTPPopupToolBar instance that was previously created.<br><br><table width="99%"><tr><td><pre class="BBcode"><br>CXTPPopupToolBar *popupBar_p = CXTPPopupToolBar::CreatePopupToolBar(m_commandBars_p);<br>popupBar_p-&gt;SetTearOffPopup(_T(toolbarTitle.c_str()), 3500, 23 * 5);<br><br>CXTPControls *controls_p = toolBar_p-&gt;GetControls();<br>CXTPControlPopup *controlPopup_p = static_cast&lt;CXTPControlPopup *&gt;(controls_p-&gt;Add(xtpControlSplitButtonPopup, 3500));<br><br>controlPopup_p-&gt;SetCommandBar(popupBar_p);<br><br>CXTPControl *control_p = popupBar_p-&gt;GetControls()-&gt;Add(xtpControlButton, 3501);<br></pre></td></tr></table><br><br>When I click on this CXTPControlButton I want to get a pointer to its CXTPControlPopup instance parent to change Icon, Tooltip, Description, .. of the parent.<br><br>How can I do this?<br><br>I tried this way (commandId_ is correctly set to 3501):<br><table width="99%"><tr><td><pre class="BBcode"><br>&nbsp;&nbsp;&nbsp; MainFrame *mainFrame_p = static_cast&lt;MainFrame *&gt;(AfxGetMainWnd());<br>&nbsp;&nbsp;&nbsp; CXTPCommandBars *commandBars_p = mainFrame_p-&gt;GetCommandBars();<br>&nbsp;&nbsp;&nbsp; CXTPControl *control_p = commandBars_p-&gt;FindControl(xtpControlButton, commandId_, TRUE, TRUE);<br>&nbsp;&nbsp;&nbsp; CXTPCommandBar *parentCommandBar_p = control_p-&gt;GetParent();<br>&nbsp;&nbsp;&nbsp; if ( parentCommandBar_p-&gt;IsPopupBar() ) {<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CXTPPopupBar *parentPopupBar_p = static_cast&lt;CXTPPopupBar *&gt;(parentCommandBar_p);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CXTPControlPopup *controlPopup_p = parentPopupBar_p-&gt;GetControlPopup();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if ( NULL != controlPopup_p ) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; controlPopup_p-&gt;SetCustomIcon(control_p-&gt;GetImage()-&gt;GetIcon().GetIcon());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br></pre></td></tr></table><br><br>But controlPopup_p is always NULL.<br>Trying to follow events chain I found this:<br>- method CXTPPopupBar::Popup is called and sets m_pControlPopup to the right pointer: "m_pControlPopup = pControlPopup;";<br>- CXTPPopupBar::SetTrackingMode is then called and it executes instruction "m_pControlPopup = 0;"<br>- finally my method to handle button click is called.<br><br>So when I handle click for my button (ID=3501) "parentPopupBar_p-&gt;GetControlPopup();" returns NULL.<br><br>Is there another way to find Popup parent? Is there another way to keep Popup parent's icon, tooltip, description, ... syncronized to last clicked button?<br><br>Thanks for any hint. Paolo<br>]]>
   </description>
   <pubDate>Thu, 17 May 2007 11:15:39 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7168&amp;PID=23002&amp;title=find-popupcontrol#23002</guid>
  </item> 
 </channel>
</rss>