02-16-2006 09:18 AM
02-16-2006 09:29 AM
Hi, you can do the following:
switch (event) {
case EVENT_LEFT_CLICK:
case EVENT_RIGHT_CLICK:
// Hilight line pointed to by mouse
GetTableCellFromPoint (panel, control, MakePoint (eventData2, eventData1), &cell);
if (cell.x == 0 && cell.y == 0) return 1; // Clicked outside the table (on the label?)
GetNumTableRows (panel, control, &r);
SetTableCellRangeAttribute (panel, control, MakeRect (1, 1, r, 6),
ATTR_TEXT_BOLD, 0); // Cancel highlight on all table (previous highlighted row)
SetTableCellRangeAttribute (panel, control, MakeRect (cell.y, 1, 1, 6),
ATTR_TEXT_BOLD, 1); // Hilight current row
break;
}
Instead of TEXT_BOLD you can use any other highlighting method.
02-13-2016 10:59 AM
Hello,
Please does not work this exemple, can you help me
02-15-2016 08:57 AM
What is your exact goal?
It's true that my example does not actually set a table selection: it highlights the row clicked cell belongs to making all cells bold.
To actually select the row you must use
GetActiveTableCell (panel, control, &cell); SetTableSelection (panel, control, VAL_TABLE_ROW_RANGE (cell.y));
The reason why I suggested those instructions is that I normally don't like how the selection appears on tables with coloured text and/or background, so I resolved to highlight the row by making the text bold. It's to be said also that I normally don't use cell selection in my programs. If you on the contrary want to leverage on cells being selected or not, SetTableSelection should give you the desired result.
02-16-2016 11:48 AM
Thank you, I found the solution