Donna,
I neglected to add a bit more code that I use in my callback. As you've
probably noticed tables in CVI exhibit quirky behaviour at times and the
snippet below eliminates some of that (but not all). I have a small app that
has an interactive year calendar with 12 tables where I need to capture the
date (cell) clicked on in order to present information to the user. It seems
that CVI (or perhaps Windows) doesn't process/update the active table cell
until after the callback event EVENT_LEFT_CLICK is issued. By waiting for
EVENT_LEFT_MOUSE_UP the system has time to correctly establish which cell
was clicked on.
It's possible that ProcessSystemEvents() will also work but I haven't tried
that.
One other thing - if the table Control Mode is 'Indicator' this will not
work - another quirk I guess. Also notice that although you can specify the
Control Mode for individual cells, it really doesn't do anything of value. I
believe this is a bug in CVI.
Here's the snippet:
int CVICALLBACK tableCB (int panel, int control, int event,
void *callbackData, int eventData1,int eventData2)
{
Point p;
static short click = 0;
switch (event) {
case EVENT_LEFT_CLICK :
// this establishes that the mouse was clicked on a table
click = 1;
break;
case EVENT_LEFT_MOUSE_UP :
if (!click) return 0;
click = 0;
switch (control) {
case PANEL_TABLE1 :
GetActiveTableCell(panel,table,&p);
// Note if p.x or p.y == 0 then not on a valid cell
break;
// repeat case for each table
}
}
}
Best regards,
George Hodgson
"donna" <x@no.email> wrote in message news:169127@exchange.ni.com...
> George,<br>Thank you so much for your reply. I used your suggestion and it
works well with one exception and I wonder if you can help me with this?
<br><br>I have two panels on this menu. <br>Panel 1 contains the table with
the column that I want to have "X"s or blank.<br>Panel 2 contains a button
which sets all of the values to "X".<br><br>After I select the button on
Panel 2 to provide X's then I see the following behavior in my table column
with the X's in Panel 1:<br><br> I need to left click the column twice.
The first time just highlights the cell and then the second time will
provide the toggle behavior. Also once I am in this mode, I can click
anywhere in the table even though I have provided checks for the cell.x
value.<br><br> It might be important to note that I defined the
EnableExtendedMouseEvents in a local function.<br>Thanks so much,<br>Donna