<?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 : CButt&#111;n Custom item</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Property Grid : CButt&#111;n Custom item]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sun, 19 Apr 2026 11:18:23 +0000</pubDate>
  <lastBuildDate>Wed, 15 Jun 2005 01:46:07 +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=2367</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[CButt&#111;n Custom item : The following coderepresents mysolution....]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2367&amp;PID=7077&amp;title=cbutton-custom-item#7077</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1231">Patrick</a><br /><strong>Subject:</strong> 2367<br /><strong>Posted:</strong> 15 June 2005 at 1:46am<br /><br /><P>The following code&nbsp;represents my&nbsp;solution. It will be interesting to see how different it is from the future sample code.</P><P>// Patrick<BR>// CCustomItemCommandBtn<BR>// 6/14/05</P><P>class CCustomItemCommandBtn;</P><P>class CInplaceCommandBtn : public CButton<BR>{<BR>public:<BR>&nbsp;afx_msg LRESULT OnClick(WPARAM wParam, WPARAM lParam);<BR>&nbsp;afx_msg HBRUSH CtlColor(CDC* pDC, UINT /*nCtlColor*/);<BR>&nbsp;&nbsp; afx_msg void OnMove(int x, int y);</P><P>&nbsp;DECLARE_MESSAGE_MAP()</P><P>protected:<BR>&nbsp;CCustomItemCommandBtn* m_pItem;<BR>&nbsp;COLORREF m_clrBack;<BR>&nbsp;CBrush m_brBack;</P><P>&nbsp;friend class CCustomItemCommandBtn;<BR>};</P><P>class CCustomItemCommandBtn : public CXTPPropertyGridItem<BR>{<BR>public:<BR>&nbsp;CCustomItemCommandBtn(CString strCaption, LPCTSTR buttonTxt = NULL, HICON hIcon = NULL);</P><P>protected:<BR>&nbsp;&nbsp; CString m_buttonTxt;<BR>&nbsp;&nbsp; HICON m_hIcon;<BR>&nbsp;&nbsp; void Create();</P><P>protected:<BR>&nbsp;virtual BOOL OnDrawItemValue(CDC&amp; dc, CRect rcValue);<BR>&nbsp;&nbsp; virtual void SetVisible(BOOL bVisible);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>private:<BR>&nbsp;CInplaceCommandBtn m_wndButton;</P><P>&nbsp;friend class CInplaceCommandBtn;<BR>};</P><P>//Patrick</P><P>// CCustomItemCommandBtn<BR>// 6/14/05</P><P><BR>BEGIN_MESSAGE_MAP(CInplaceCommandBtn, CButton)<BR>&nbsp;ON_MESSAGE(BM_SETSTATE, OnClick)<BR>&nbsp;ON_WM_CTLCOLOR_REFLECT()<BR>&nbsp;ON_WM_MOVE()<BR>END_MESSAGE_MAP()</P><P>HBRUSH CInplaceCommandBtn::CtlColor(CDC* pDC, UINT /*nCtlColor*/)<BR>{<BR>&nbsp;class CGridView : public CXTPPropertyGridView<BR>&nbsp;{<BR>&nbsp;&nbsp;friend class CInplaceCommandBtn;<BR>&nbsp;};</P><P>&nbsp;CGridView* pGrid = (CGridView*)m_pItem-&gt;m_pGrid;</P><P>&nbsp;COLORREF clr = pGrid-&gt;m_clrBack;</P><P>&nbsp;if (clr != m_clrBack || !m_brBack.GetSafeHandle())<BR>&nbsp;{<BR>&nbsp;&nbsp;m_brBack.DeleteObject();<BR>&nbsp;&nbsp;m_brBack.CreateSolidBrush(clr);<BR>&nbsp;&nbsp;m_clrBack = clr;<BR>&nbsp;}</P><P>&nbsp;pDC-&gt;SetBkColor(m_clrBack);<BR>&nbsp;return m_brBack;<BR>}</P><P>LRESULT CInplaceCommandBtn::OnClick(WPARAM wParam, WPARAM lParam)<BR>{<BR>&nbsp;&nbsp; if (!wParam)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_pItem-&gt;OnValueChanged(_T(""));<BR>&nbsp;&nbsp; return CButton::DefWindowProc(BM_SETSTATE, wParam, lParam);<BR>}</P><P>void CInplaceCommandBtn::OnMove(int, int)<BR>{<BR>&nbsp;&nbsp; Invalidate();<BR>}</P><P><BR>CCustomItemCommandBtn::CCustomItemCommandBtn(CString strCaption, <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;  LPCTSTR buttonTxt /*=NULL*/, HICON hIcon/*=NULL*/)<BR>&nbsp;: CXTPPropertyGridItem(strCaption)<BR>{<BR>&nbsp;m_wndButton.m_pItem = this;<BR>&nbsp;m_nFlags = 0;<BR>&nbsp;&nbsp; m_buttonTxt = buttonTxt;<BR>&nbsp;&nbsp; m_hIcon = hIcon;<BR>}</P><P>void CCustomItemCommandBtn::Create()<BR>{<BR>&nbsp;&nbsp; DWORD style = WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | (m_hIcon ? BS_ICON : 0);<BR>&nbsp;&nbsp; m_wndButton.Create(m_buttonTxt, style, GetValueRect(), (CWnd*)m_pGrid, 0);<BR>&nbsp;&nbsp; if (m_hIcon)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_wndButton.SetIcon(m_hIcon);<BR>&nbsp;&nbsp; }<BR>}</P><P>BOOL CCustomItemCommandBtn::OnDrawItemValue(CDC&amp;, CRect)<BR>{<BR>&nbsp;&nbsp; if (!m_wndButton.m_hWnd)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create();<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; m_wndButton.MoveWindow(GetValueRect());<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; return TRUE;<BR>}</P><P>void CCustomItemCommandBtn::SetVisible(BOOL bVisible)<BR>{<BR>&nbsp;&nbsp; CXTPPropertyGridItem::SetVisible(bVisible);<BR>&nbsp;&nbsp; if (m_wndButton.m_hWnd)<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_wndButton.ShowWindow(bVisible ? SW_SHOW : SW_HIDE);<BR>&nbsp;&nbsp; }<BR>&nbsp;&nbsp; else<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create();<BR>&nbsp;&nbsp; }<BR>}</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Wed, 15 Jun 2005 01:46:07 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2367&amp;PID=7077&amp;title=cbutton-custom-item#7077</guid>
  </item> 
  <item>
   <title><![CDATA[CButt&#111;n Custom item : oleg, Thank you for the quick...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2367&amp;PID=7052&amp;title=cbutton-custom-item#7052</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1231">Patrick</a><br /><strong>Subject:</strong> 2367<br /><strong>Posted:</strong> 13 June 2005 at 6:04am<br /><br /><P><SPAN style="FONT-SIZE: 5.5pt; COLOR: black; FONT-FAMILY: Verdana"><FONT size=1>oleg,<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT></SPAN></P><P><SPAN style="FONT-SIZE: 5.5pt; COLOR: black; FONT-FAMILY: Verdana"><FONT size=1>Thank you for the quick reply!&nbsp; When will the sample code be available and how may I obtain it?&nbsp; Is it possible to get it now?<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>By the way, your product is outstanding! <SPAN style="mso-spacerun: yes">&nbsp;</SPAN>The best object model and implementation I have seen in any off the shelf visual component.<o:p></o:p></FONT></SPAN></P><P><SPAN style="FONT-SIZE: 5.5pt; COLOR: black; FONT-FAMILY: Verdana"><FONT size=1>Thanks again,<o:p></o:p></FONT></SPAN></P><P><SPAN style="FONT-SIZE: 5.5pt; COLOR: black; FONT-FAMILY: Verdana"><FONT size=1>Patrick<o:p></o:p></FONT></SPAN></P><P><FONT size=1></FONT>&nbsp;</P>]]>
   </description>
   <pubDate>Mon, 13 Jun 2005 06:04:40 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2367&amp;PID=7052&amp;title=cbutton-custom-item#7052</guid>
  </item> 
  <item>
   <title><![CDATA[CButt&#111;n Custom item : We added this sample to PropertyGrid...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2367&amp;PID=7049&amp;title=cbutton-custom-item#7049</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 2367<br /><strong>Posted:</strong> 13 June 2005 at 4:31am<br /><br /><P>We added this sample to PropertyGrid sample for next release.</P><P>After item expnaded/collapsed SetVisible is called. You can override it and test </P><P>m_bVisible state.</P>]]>
   </description>
   <pubDate>Mon, 13 Jun 2005 04:31:56 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2367&amp;PID=7049&amp;title=cbutton-custom-item#7049</guid>
  </item> 
  <item>
   <title><![CDATA[CButt&#111;n Custom item : I would like to create a custom...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2367&amp;PID=7046&amp;title=cbutton-custom-item#7046</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1231">Patrick</a><br /><strong>Subject:</strong> 2367<br /><strong>Posted:</strong> 12 June 2005 at 10:46pm<br /><br /><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><FONT face="Times New Roman" size=2>I would like to create a custom item that is a simple command button (CButton).<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>I would like the button always to be visible (e.g., even if it has not been selected) unless its category is collapsed, and receive an event when the button is clicked.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>I have a partially working version but it does not property hide or show itself when its category is expanded or collapsed.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>Thanks in advance for any help.</FONT></P>]]>
   </description>
   <pubDate>Sun, 12 Jun 2005 22:46:46 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2367&amp;PID=7046&amp;title=cbutton-custom-item#7046</guid>
  </item> 
 </channel>
</rss>