From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Table cell problem... how to distinguish scroll double click event or cell double click events ?

How can I distinguish scroll double click events or cell double click events ? In a table. Actually when a Double left click event happen ... I get the active cell with GetActiveTableCell... but there is no difference (same cell) when I double click the scroll bar in the table.

thank you very much !
0 Kudos
Message 1 of 3
(2,946 Views)
You need to know how wide the table is and how wide the scrollbar is. Here's some code you could add to the colview project that ships with CVI
if (event == EVENT_LEFT_DOUBLE_CLICK)
{
int nTableWidth;
int nScrollBarWidth;
GetCtrlAttribute (panel, MAINPNL_RESULTS, ATTR_SCROLL_BAR_SIZE, &nScrollBarWidth);
GetCtrlAttribute (panel, MAINPNL_RESULTS, ATTR_WIDTH, &nTableWidth);
// for EVENT_LEFT_DOUBLE_CLICK, eventData2 = mouse horizontal position
if (eventData2 >= (nTableWidth - nScrollBarWidth))
MessagePopup ("DoubleClick", "Double click on scrollbar");
}
0 Kudos
Message 2 of 3
(2,946 Views)
David,

Another thing that you need to take into account here is the way that the events get processed in the table control.

When the user generates a click in the UI the table, the callback in your code gets called before the actual control proces the callback, the result is that when you get the callback the selected cell has not changed.

Here is a good example on what you need to do to read the cell where the user clicked. The program uses postDeferredCall().
http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3E8FF56A4E034080020E74861&p_node=DZ52154&p_source=External

You could check whether the selected cell changed or to identify if the click was for a scroll bar or an actual new cell selection.

I hope this helps.

Regards,


Juan Carlos
N.I.
0 Kudos
Message 3 of 3
(2,946 Views)