LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to delet a row or column in the table with labwindows

I want to delet any row or any column,how can I do it?? 
0 Kudos
Message 1 of 5
(3,927 Views)
Hi,

Use DeleteTableRows and DeleteTableColumns to delete one or more rows or columns.  These functions take a 1-based row/column index, as well as the number or rows/coulmns you want to delete.  For example, if you just wanted to delete row 3 from your table, you would call:

DeleteTableRows(panelHandle, tableCtrl, 3, 1);

If you wanted to delete rows 3 and 4, you would call:

DeleteTableRows(panelHandle, tableCtrl, 3, 2);

Hope that helps.

Mert A.
National Instruments
0 Kudos
Message 2 of 5
(3,914 Views)
hehe,I know the function that you refered,but I want to know how to delet a row which select by the mouse in the table , i don't know how  to tell the funtion that which row or column has been selected.
0 Kudos
Message 3 of 5
(3,896 Views)

GetActiveTableCell returns the address of the active cell in a Point structure. See the help on this function for more details. To delete one row, basically you need only two functions:

 GetActiveTableCell (panel, control, &cell);
 DeleteTableRows (panel, control, cell.y, 1);

To delete multiple highlighted rows, you can use these functions:

 GetTableSelection (panel, control, &area);
 DeleteTableRows (panel, control, area.top, area.height);



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?
0 Kudos
Message 4 of 5
(3,885 Views)
I'm sorry I misunderstood your previous post; a little more detail would have been helpful ;).

What you probably want to do is use the selected table cell range to determine which rows/columns to delete.  You can get the range of selected cells with the GetTableSelection function, then call the appropriate delete rows/columns function:

Rect selection;

GetTableSelection (panelHandle, tableCtrl, &selection);

if (selection.top > 0) /* there may not be any selected cells in the table */
{
    /* If you want to delete rows */
    DeleteTableRows (panelHandle, tableCtrl, selection.top, selection.height);

    /* If you want to delete columns */
    DeleteTableColumns (panelHandle, tableCtrl, selection.left, selection.width);
}


Hope this helps.

Mert A.
National Instruments
0 Kudos
Message 5 of 5
(3,882 Views)