05-03-2004 05:00 AM
05-04-2004 09:04 AM
05-07-2008 05:42 PM
Could I get an example on this? I could not find/get the check box picture in the table by the callback listed in the reply.
Thanks
ChipB
05-08-2008 02:50 AM
ChipB, if you are using latest cvi versions you can benefit from new cell types that were introduced in version 8, specifically ring cell type: as an alternative to a checkbox you could create two items labelled Yes and No in a ring cell. in the table callback you will retrieve the cell value on a COMMIT event as a string and discriminate on it.
Regarding Luis suggestion, you must have a checkbox elsewere in the panel, retrieve its bitmap with GetCtrlBitmap (panel, control, 0, &bitmap); (well, two bitmaps, corresponding to checked / unchecked values; the bitmap can next be discarded) and load one of them as an image in a table cell of picture type: in the callback for table you will need to update the cell picture depending on previously loaded one. Consider that a cell can hold values for different types regardless the type shown: you can show a picture in a cell but contemporarily hold a integer value 0 or 1 corresponding to the "checkbox" value shown. in the callback function you can manipulate both the picture and the value associated to the cell.
05-08-2008 11:18 AM
Here is a simple program that shows how to easily put a check box in a table cell.
http://forums.ni.com/ni/board/message?board.id=180&message.id=13287#M13287
12-02-2008 12:09 PM
Ok, I got the check box to change state... but getting a 1 or 0 returned escapes me... I have a table of measurements and the checked measurements I want to put into an array to do a linear extrapolation on... but when I roll through the row 1 column(count) to find the "checked" items, I don't get a returned value. what is the reason? same program used just build a on/off array
ChipB
12-03-2008 10:53 AM
In the tableCheck example program (from the link in my previous post), check out the function ToggleTableCellCheck. It is storing the 1 or 0 (or whether the checkbox is checked or not) in the numeric value of the table cell. You could make a function like this to return the check state of a table cell.
/* returns 1 if the cell is checked, 0 if the cell is unchecked */
int GetCellCheckedState(int panel, int table, Point cell)
{
int val;
SetTableCellAttribute(panel, table, cell, ATTR_CELL_TYPE, VAL_CELL_NUMERIC);
GetTableCellVal(panel, table, cell, &val);
SetTableCellAttribute(panel, table, cell, ATTR_CELL_TYPE, VAL_CELL_PICTURE);
return val;
}
I hope this helps.
- jared