LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in GetTableSelection?

The output from GetTableSelection does not appear to be as in the fp.
If there is no selection I get a (0, 0, 1, 1) rect returned not VAL_EMPTY_RECT (0, 0, 0, 0) as I should.
Also, the function does not appear to return the correct rect if a single cell is selected, again returning (0, 0, 1, 1).
Regards,
Paul Barber
0 Kudos
Message 1 of 6
(3,841 Views)
Part of this is a bug that we have fixed an will be in the next release. The GetTableSelection should be returning the VAL_EMPTY_RECT when there is no selection, not the rect(0,0,1,1). This is a bug that we fixed.

The second part is just an area of confusion that we will fix in our documentation. There is a difference between a selection and an active cell. If there is only one single cell highlighted, it is usually the active cell with no selection defined. You can define a one cell selection with SetTableSelection, but not by just clicking on a cell on the table. Clicking on a cell, sets that as the active cell and sets the table to have no selection. So, if you check GetTableSelection and get no selection, call GetActiveTableCell to find out w
hich cell is highlighted.

Best Regards,

Chris Matthews
National Instruments
Message 2 of 6
(3,841 Views)

Dear Sir, my problem with GetTableSelection is that always the content of the variable with coordinates always is (0,0,0,0). The table cell respond to the event DOUBLE_CLICK correctly and if I ask for the cell clicked with the function GetActiveTableCell the function respond with the x,y values correctly but not the function GetTableSelection, always respond with zeroes in the struct Rect. Please, I need to know how to resolve this problem. I have tried to check in release 10, 12 and 13 SP1 of LabWindows/CVI. Thanks in advance.


Chris Matthews escribió:
Part of this is a bug that we have fixed an will be in the next release. The GetTableSelection should be returning the VAL_EMPTY_RECT when there is no selection, not the rect(0,0,1,1). This is a bug that we fixed.

The second part is just an area of confusion that we will fix in our documentation. There is a difference between a selection and an active cell. If there is only one single cell highlighted, it is usually the active cell with no selection defined. You can define a one cell selection with SetTableSelection, but not by just clicking on a cell on the table. Clicking on a cell, sets that as the active cell and sets the table to have no selection. So, if you check GetTableSelection and get no selection, call GetActiveTableCell to find out w
hich cell is highlighted.

Best Regards,

Chris Matthews
National Instruments

 

0 Kudos
Message 3 of 6
(3,310 Views)

Rect (0, 0, 0, 0) is the value of VAL_EMPTY_RECT, which is what the system returns when no selection is present on the table.

According for the documentation for GetTableSelection, there can be be no actual selection: see also Operating Table Controls for reference on how to manually create a selection and Programming with Table Controls for reference on how to programmatically create one

 

As a last note, it would be better to open a new thread instead of reviving a 13-years-old one. If needed, make a reference to the old thread so that we can see what you are referring to.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 6
(3,300 Views)

Dear Roberto Bozzolo,

 

Thank you very much for your fast response, but, when I make double click in a cell, the cell is selected. In the old version 5.5 this function run fine and correctly, but in the new versions not run. If I have understood your solution I have to detect the cell selected using others Table functions and makes selected manually the cell using SetTableSelection to use then the function GetTableSelection and in this manner read the struct Rect correctly, is it true?.

 

Are NI thinking about to resolve and avoid this bug?.

 

Thanks in advance.

 

0 Kudos
Message 5 of 6
(3,290 Views)

According to what Chris Mattew said back in 2002, I don't think NI is considering this a bug: while a table always have an active cell, it can have no cell(s) selected.

I don't remember what was happening in 5.5 but I seem to remember that the table control was a separate instrument at the time and not a native control, so it could have different handling.

 

At present, double clicking on a cell does not selects the cell nor fires the commit event but rather it changes table state to edit mode; it may change the active cell.

You may want to handle EVENT_SELECTION_CHANGE or EVENT_ACTIVE_CELL_CHANGE instead: they may be a better choice depending on your application.

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 6 of 6
(3,281 Views)