<?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 : Property Grid. Getting direct access to controls</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Property Grid. Getting direct access to controls]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sun, 07 Jun 2026 13:10:27 +0000</pubDate>
  <lastBuildDate>Mon, 05 Mar 2007 11:37:58 +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=4650</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[Property Grid. Getting direct access to controls : Thanks you so much guys. The new...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20904&amp;title=property-grid-getting-direct-access-to-controls#20904</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2190">Tomas</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 05 March 2007 at 11:37am<br /><br />Thanks you so much guys. The new property system rocks!!! <DIV></DIV>]]>
   </description>
   <pubDate>Mon, 05 Mar 2007 11:37:58 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20904&amp;title=property-grid-getting-direct-access-to-controls#20904</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls :   Tomas wrote:DrawInplaceButtons...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20794&amp;title=property-grid-getting-direct-access-to-controls#20794</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2321">JohnCrenshaw</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 27 February 2007 at 3:23pm<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by Tomas" alt="Originally posted by Tomas" style="vertical-align: text-bottom;" /> <strong>Tomas wrote:</strong><br /><br />DrawInplaceButtons is a protected member of CXTPPropertyGridPaintManager so I don't have access to it. Do you have an example of this? <DIV></DIV></td></tr></table> <DIV>When I have a problem like this, where a member is protected that ought not be, I cheat. Derived classes can access protected members so I create a derived class with a static "access" function that takes a pointer to the other class and the parameters. For example:</DIV><DIV>&nbsp;</DIV><DIV>class CSomeHelper : publid CClassWithStupidProtectedMember</DIV><DIV>{</DIV><DIV>public:</DIV><DIV>&nbsp;&nbsp; static int DoProtectedFunction(CClassWithStupidProtectedMember* p, UINT param)</DIV><DIV>&nbsp; &nbsp;{</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return ((CSomeHelper*)p)-&gt;ProtectedFunction(param);</DIV><DIV>&nbsp;&nbsp; }</DIV><DIV>};</DIV><DIV>&nbsp;</DIV><DIV>Then, in&nbsp;places where I really am sure that I should call the protected function, and have the right to, I can&nbsp; do so via CSomeHelper::DoProtectedFunction(p, param);</DIV><DIV>&nbsp;</DIV><DIV>This is technically bad, but it is a lot more clean than changing the protected status of things or adding a friend. If you change the CodeJock code, then when the next update comes out, your program breaks. If you use my nasty hack,<img src="http://forum.codejock.com/smileys/smiley11.gif" border="0"> your code (probably) works.<img src="http://forum.codejock.com/smileys/smiley4.gif" border="0"></DIV><DIV>&nbsp;</DIV><DIV>The way I see it, this hack is far from clean code, but it is much cleaner and maintainable than any alternative.</DIV>]]>
   </description>
   <pubDate>Tue, 27 Feb 2007 15:23:14 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20794&amp;title=property-grid-getting-direct-access-to-controls#20794</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls : DrawInplaceButtons is a protected...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20792&amp;title=property-grid-getting-direct-access-to-controls#20792</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2190">Tomas</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 27 February 2007 at 2:56pm<br /><br />DrawInplaceButtons is a protected member of CXTPPropertyGridPaintManager so I dont have access to it. Do you have an example of this?<DIV></DIV>]]>
   </description>
   <pubDate>Tue, 27 Feb 2007 14:56:25 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20792&amp;title=property-grid-getting-direct-access-to-controls#20792</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls : Hello, Yes, buttons now drawn...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20722&amp;title=property-grid-getting-direct-access-to-controls#20722</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 25 February 2007 at 12:28am<br /><br />Hello, Yes, buttons now drawn in Drawitem method. Add this call:<DIV>&nbsp;</DIV><DIV>if (bSelected || m_pGrid-&gt;GetShowInplaceButtonsAlways()) pPaintManager-&gt;DrawInplaceButtons(&amp;dc, pItem, rcValue);<BR></DIV>]]>
   </description>
   <pubDate>Sun, 25 Feb 2007 00:28:43 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20722&amp;title=property-grid-getting-direct-access-to-controls#20722</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls : In 10.4.2 ones you are drawing...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20712&amp;title=property-grid-getting-direct-access-to-controls#20712</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2190">Tomas</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 23 February 2007 at 12:09pm<br /><br />In 10.4.2 ones you are drawing your own grid using&nbsp;&nbsp;XTP_PGS_OWNERDRAW the inplace buttons don't show any more.<DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 23 Feb 2007 12:09:20 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20712&amp;title=property-grid-getting-direct-access-to-controls#20712</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls : That is a cool first step. What...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20491&amp;title=property-grid-getting-direct-access-to-controls#20491</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2190">Tomas</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 15 February 2007 at 6:31pm<br /><br /><P><SPAN lang=EN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-ansi-: EN">That is a cool first step. What I really need to display are ALL the buttons not just the in-place </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana">buttons</SPAN><SPAN lang=EN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-ansi-: EN">. That means that things like the sliders (User controls)&nbsp;and such should display as well. This is very important for us. As the user can be tweaking their properties and they don’t want to be selecting them first. Do you think it will be a hard feature to add for you guys?</P><DIV></DIV><P>Tomas<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>]]>
   </description>
   <pubDate>Thu, 15 Feb 2007 18:31:08 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=20491&amp;title=property-grid-getting-direct-access-to-controls#20491</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls : btw.. In 10.4 added property to...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=18666&amp;title=property-grid-getting-direct-access-to-controls#18666</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 28 December 2006 at 1:25am<br /><br />btw.. In 10.4 added property to show all inplace buttons.]]>
   </description>
   <pubDate>Thu, 28 Dec 2006 01:25:50 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=18666&amp;title=property-grid-getting-direct-access-to-controls#18666</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls :   oleg wrote:Hi,  It is not...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=16656&amp;title=property-grid-getting-direct-access-to-controls#16656</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2321">JohnCrenshaw</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 19 October 2006 at 11:17am<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by oleg" alt="Originally posted by oleg" style="vertical-align: text-bottom;" /> <strong>oleg wrote:</strong><br /><br />Hi, <DIV>It is not possible :(</DIV></td></tr></table> <DIV>&nbsp;</DIV><DIV>Are you sure? C'mon, you don't strike me as a defeatist<img src="http://forum.codejock.com/smileys/smiley2.gif" border="0">. Not only is there a way to do this, it is painfully simple.</DIV><DIV>&nbsp;</DIV><DIV>There is a function CXTPPropertyGridItem::SetFocusToInplaceControl() that&nbsp;is designed for setting this editable state.</DIV><DIV>&nbsp;</DIV><DIV>Inside&nbsp;CXTPPropertyGrid::OnNavigate() we find this snippet, suggesting that the item must be selected prior to focusing the control but I havn't checked this for sure.</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;pItem-&gt;OnSelect();<BR>&nbsp;&nbsp;&nbsp;&nbsp;pItem-&gt;SetFocusToInplaceControl();<BR>&nbsp;&nbsp;&nbsp;&nbsp;return;<BR></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>Finally, the CXTPPropertyGrid class has the following function declaration:</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>&nbsp;&nbsp; virtual void OnSelectionChanged(CXTPPropertyGridItem* pItem);</DIV><DIV></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>To get what you want, declare a new class based on the grid, then override the selection changed function. Call SetFocusToInplaceControl() for the control recieving the focus in the override. I&nbsp;make this call AFTER calling the base OnSelectionChanged() since it is for the user's convenience only. See the following snippet:</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>class COneClickPropertyGrid : public CXTPPropertyGrid<BR>{<BR>// Best Practice: Uncomment this and call IMPLEMENT_DYNAMIC() in the CPP file<BR>//&nbsp;&nbsp; DECLARE_DYNAMIC(COneClickPropertyGrid)</DIV><DIV>public:<BR>&nbsp;&nbsp; COneClickPropertyGrid() : CXTPPropertyGrid() {}</DIV><DIV>&nbsp;&nbsp; // Best Practice: this shouldn't be inline<BR>&nbsp;&nbsp; virtual void OnSelectionChanged(CXTPPropertyGridItem* pItem)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CXTPPropertyGrid::OnSelectionChanged(pItem);</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // pItem is NULL sometimes<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (pItem)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // set the item focus with a single click<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pItem-&gt;SetFocusToInplaceControl();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; }<BR>};<BR></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>This is probably incomplete, for example, you may want to do something similar when the control is activated. Also, the edit control is fully highlighted at this point. This may or may not be the behavior you want but can be fixed.</DIV><DIV>&nbsp;</DIV><DIV>This is the code responsible for highlighting everything:</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>void CXTPPropertyGridItem::SetFocusToInplaceControl()<BR>{<BR>&nbsp;CXTPPropertyGridInplaceEdit&amp; wndEdit = GetInplaceEdit();</DIV><DIV>&nbsp;if (wndEdit.GetSafeHwnd() &amp;&amp; wndEdit.GetItem() == this)<BR>&nbsp;{<BR>&nbsp;&nbsp;wndEdit.SetFocus();<BR>&nbsp;&nbsp;wndEdit.SetSel(0, -1); // This highlights all the text<BR>&nbsp;}<BR>}<BR></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>Since the above is a virtual function, you can change the behavior on a case by case basis.</DIV><DIV>&nbsp;</DIV><DIV>Hope this helps!</DIV>]]>
   </description>
   <pubDate>Thu, 19 Oct 2006 11:17:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=16656&amp;title=property-grid-getting-direct-access-to-controls#16656</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls : I place my vote for this too!...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=14715&amp;title=property-grid-getting-direct-access-to-controls#14715</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2223">Tomasz</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 05 August 2006 at 7:08am<br /><br />I place my vote for this too! <DIV></DIV><DIV>&nbsp;</DIV><DIV>2+ clicks or more for changing property value is way too much for user-friendly application. My customers are complaining about having to click twice. </DIV><DIV>&nbsp;</DIV><DIV>So please, pretty&nbsp;please with sugar on top, give us an option for one-click property change.</DIV>]]>
   </description>
   <pubDate>Sat, 05 Aug 2006 07:08:33 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=14715&amp;title=property-grid-getting-direct-access-to-controls#14715</guid>
  </item> 
  <item>
   <title><![CDATA[Property Grid. Getting direct access to controls :    oleg wrote::) Added to wish...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=14388&amp;title=property-grid-getting-direct-access-to-controls#14388</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2190">Tomas</a><br /><strong>Subject:</strong> 4650<br /><strong>Posted:</strong> 26 July 2006 at 9:36am<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by oleg" alt="Originally posted by oleg" style="vertical-align: text-bottom;" /> <strong>oleg wrote:</strong><br /><br />:) Added to wish list for 10.4.</td></tr></table><br><br>Ho man 10.4 and in a wish list? That doesn't sound very promissing... <img alt="Ouch" src="http://forum.codejock.com/smileys/smiley18.gif" align="absmiddle" border="0"><br><br>Tomas<br><br>]]>
   </description>
   <pubDate>Wed, 26 Jul 2006 09:36:42 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=4650&amp;PID=14388&amp;title=property-grid-getting-direct-access-to-controls#14388</guid>
  </item> 
 </channel>
</rss>