<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Possible bug found in GetTableCellFromPoint when used with large tables (CVI 8.1 on XPThis ) in LabWindows/CVI</title>
    <link>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/486853#M28131</link>
    <description>I just tried to replicate this and was unable to get the same results. The output (without the added code you provided) gave me the correct values. It is possible that something has gone wrong with you CVI installation. Try repairing the installation or possibly uninstalling and reinstalling.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 05 Mar 2007 22:20:28 GMT</pubDate>
    <dc:creator>Brandon_V</dc:creator>
    <dc:date>2007-03-05T22:20:28Z</dc:date>
    <item>
      <title>Possible bug found in GetTableCellFromPoint when used with large tables (CVI 8.1 on XPThis )</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/486080#M28087</link>
      <description>&lt;DIV&gt;There is a possible bug that I&amp;nbsp;found in "GetTableCellFromPoint" when used with large tables on CVI 8.1 under XP Pro SP2.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Create a table in a UIR panel, populate it with lots of empty row and columns with both scroll bars activated.&amp;nbsp; Use&amp;nbsp;enough rows and columns&amp;nbsp;to go force the table to turn on the scrol bars.&amp;nbsp; Add a callback function to the table.&amp;nbsp; In that callback, add the event that captures the mouse cursor movement.&amp;nbsp; Add a custom function to that particular event branch&amp;nbsp;that reports back the row index and column index.&amp;nbsp; That would look something like this.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;int __cdecl TableCCB (int panel, int control, int event,&amp;nbsp;&amp;nbsp;void *callbackData, int eventData1, int eventData2)&lt;BR /&gt;{&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;rowIndex;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;colIndex;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch (event) {&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case EVENT_MOUSE_POINTER_MOVE:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MouseOverGetsTableCell (panel, control,&amp;nbsp;eventData2, eventData1, &amp;amp;rowIndex, &amp;amp;colIndex);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;return 0;&lt;/DIV&gt;
&lt;DIV&gt;}&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Your custom function would be like this (the print statement was temporarily added for text reporting from this function):&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;static int __stdcall MouseOverGetsTableCell (int pnl, int ctrl,&amp;nbsp;int msX, int msY, int *row, int *col)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rect&amp;nbsp;&amp;nbsp;&amp;nbsp;gridCoords;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Point&amp;nbsp;&amp;nbsp;&amp;nbsp;hoverCell;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*----------------------------------------------------------------------*/&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetTableCellRangeRect (pnl, ctrl, VAL_TABLE_ENTIRE_RANGE, &amp;amp;gridCoords);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetTableCellFromPoint (pnl, ctrl, MakePoint (msX, msY), &amp;amp;hoverCell);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf ("Row = %4d, Col = %4d.\n", hoverCell.y, hoverCell.x);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *row = hoverCell.y;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *col = hoverCell.x;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;You will notice that when you hover over the row labels and the column labels, it will report erroneous cell values.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I already got a fix for this for my use, using a technique from one of the CVI samples.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Insert the following where the "/*----*/" comment is located and add the appropriate Rect and int variables:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetTableCellRangeRect (pnl, ctrl, VAL_TABLE_ENTIRE_RANGE, &amp;amp;labelCoords);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetCtrlAttribute (pnl, ctrl,&amp;nbsp; ATTR_ROW_LABELS_WIDTH, &amp;amp;labelCoords.width);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetCtrlAttribute (pnl, ctrl, ATTR_GRID_AREA_LEFT, &amp;amp;gridLeft); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetCtrlAttribute (pnl, ctrl, ATTR_LEFT, &amp;amp;tableLeft); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; labelCoords.left = tableLeft + gridLeft - labelCoords.width;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (RectContainsPoint (labelCoords, MakePoint (msX, msY))) {&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *row = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *col = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf ("Mouse is over row label area.\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetTableCellRangeRect (pnl, ctrl, VAL_TABLE_ENTIRE_RANGE, &amp;amp;labelCoords);&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetCtrlAttribute (pnl, ctrl, ATTR_COLUMN_LABELS_HEIGHT,&amp;nbsp;&amp;amp;labelCoords.height);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetCtrlAttribute (pnl, ctrl, ATTR_GRID_AREA_TOP, &amp;amp;gridTop); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetCtrlAttribute (pnl, ctrl, ATTR_TOP, &amp;amp;tableTop); &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; labelCoords.top = tableTop + gridTop - labelCoords.height;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (RectContainsPoint (labelCoords, MakePoint (msX, msY))) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *row = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;*col = 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf ("Mouse is over col label area.\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Does anyone have any&amp;nbsp;comments on whether this is a CVI bug or not?&lt;/DIV&gt;
&lt;DIV&gt;I don't recall that behavior before, and I think I was using tables ever since they first appeared...&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;JB&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sat, 03 Mar 2007 18:27:10 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/486080#M28087</guid>
      <dc:creator>JumperBones</dc:creator>
      <dc:date>2007-03-03T18:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Possible bug found in GetTableCellFromPoint when used with large tables (CVI 8.1 on XPThis )</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/486853#M28131</link>
      <description>I just tried to replicate this and was unable to get the same results. The output (without the added code you provided) gave me the correct values. It is possible that something has gone wrong with you CVI installation. Try repairing the installation or possibly uninstalling and reinstalling.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 05 Mar 2007 22:20:28 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/486853#M28131</guid>
      <dc:creator>Brandon_V</dc:creator>
      <dc:date>2007-03-05T22:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Possible bug found in GetTableCellFromPoint when used with large tables (CVI 8.1 on XPThis )</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/486902#M28136</link>
      <description>Hello JB,&lt;BR /&gt;&lt;BR /&gt;I noticed that when I hover over the column labels, and the table is not scrolled all the way to the top, the values returned are not (0,0) as you'd expect, but isntead correspond to the row that would be "behind" the column labels. And the same thing happens with the row labels, if the table is not scrolled all the way to the left.&lt;BR /&gt;&lt;BR /&gt;I'll have to investigate this a bit further, but at first glance, this does seem like a bug. Thanks for reporting this!&lt;BR /&gt;&lt;BR /&gt;Luis</description>
      <pubDate>Mon, 05 Mar 2007 23:55:51 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/486902#M28136</guid>
      <dc:creator>LuisG</dc:creator>
      <dc:date>2007-03-05T23:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Possible bug found in GetTableCellFromPoint when used with large tables (CVI 8.1 on XPThis )</title>
      <link>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/487396#M28163</link>
      <description>Sorry that in my original posting I forgot to say that you've got to push either of the two scroll bars to some percentage of their scrolling range, and *then* move your cursor outside the grid area and over the label areas in order to see the behavior that Luis and I were able to see.  I guess I was too busy cutting and pasting the code that discovered and fixed this bug...&lt;BR /&gt;&lt;BR /&gt;That fix I gave solves it for me for now, and I don't suspect that this would be a show-stopper for many CVI users.  So I guess that this can be a back-burner bug-fix for a future revision.  Which means that I still won't get a free NI T-shirt for finding a bug in CVI!  :^)&lt;BR /&gt;&lt;BR /&gt;But this is a good thing, really...&lt;BR /&gt;&lt;BR /&gt;JB</description>
      <pubDate>Tue, 06 Mar 2007 19:13:11 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabWindows-CVI/Possible-bug-found-in-GetTableCellFromPoint-when-used-with-large/m-p/487396#M28163</guid>
      <dc:creator>Jumper_Bones</dc:creator>
      <dc:date>2007-03-06T19:13:11Z</dc:date>
    </item>
  </channel>
</rss>

