<?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 : Listview DblClick in which column</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Controls : Listview DblClick in which column]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 12 May 2026 21:03:37 +0000</pubDate>
  <lastBuildDate>Wed, 13 Feb 2019 07:08:52 +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=23817</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[Listview DblClick in which column : I&amp;#039;m using the Codejock-Listview-Control...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=23817&amp;PID=77260&amp;title=listview-dblclick-in-which-column#77260</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4998">iamgtd</a><br /><strong>Subject:</strong> 23817<br /><strong>Posted:</strong> 13 February 2019 at 7:08am<br /><br /><div>I'm using the Codejock-Listview-Control with the report view (xtpListViewReport). In the listview there are ListviewItems with some ListviewSubItems.</div><div>I use the doubleclick-event to know which item and in which column was doubleclicked.</div><div><br></div><div>The DblClick-event is also fired if it is clicked in the area without items. So I can't use the SelectedItem-property to check which item is doubleclicked.</div><div><br></div><div>This behaviour I solved with the Hittest-method. This works also if it's vertically scrolled.</div><div><br></div><div>To check in which column was clicked, I calc the column-width - see the code. But if there is horizontally scrolled, the result is wrong.</div><div><br></div><div>Question: How Can I detect the horizontally scroll-offset?</div><div><br></div><div>private void cjListView_DblClick(object sender, EventArgs e)</div><div>{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int f = 16; // it's necessary for a correct result</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XtremeSuiteControls.ListViewItem lvi = cjListView.HitTest((float)currentmouse_x * f, (float)(currentmouse_y - cjListView.Margin.Top) * f);</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (lvi == null)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // DblClick was not on a ListViewItem</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div><span style="white-space:pre">	</span>&nbsp; &nbsp; &nbsp;// get the clicked column</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x_coordinate= cjListView.Margin.Left;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int selected_col = 0;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int i = 1; i &lt; cjListView.ColumnHeaders.Count + 1; i++)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x_coordinate += cjListView.ColumnHeaders<em>.Width;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (x_coordinate &gt; currentmouse_x)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selected_col = i;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div><span style="white-space:pre">			</span>MessageBox.Show("Hittest: " + lvi.Text + Environment.NewLine + "Column: " + selected_col.ToString());</div><div><br></div><div>}</div><div><br></div><div>private void cjListView_MouseUpEvent(object sender, AxXtremeSuiteControls._DListViewEvents_MouseUpEvent e)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentmouse_x = e.x;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentmouse_y = e.y;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>]]>
   </description>
   <pubDate>Wed, 13 Feb 2019 07:08:52 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=23817&amp;PID=77260&amp;title=listview-dblclick-in-which-column#77260</guid>
  </item> 
 </channel>
</rss>