Alvin wrote:
> replace:
> 
>    case CONTEXT_CELL:
>       return;           // fltk handles drawing the widgets
> 
> with:
> 
>    case CONTEXT_CELL:
>    {
>       Fl_Widget *cell = child(R*cols() + C);
> 
>       if(row_selected(R))
>       {
>          printf("R: %d C: %d selected\n", R, C);
>          cell->color(FL_YELLOW);
>       }
>       else
>          cell->color(color());
> 
>       cell->redraw();
>    }
>    return;              // fltk handles drawing the widgets


        I think the problem here might be that since we're in the draw_cell()
        routine, we're basically in FLTK's draw() call.

        So calling redraw() might not be useful in this context.

        What I did find is that if I changed the cell->redraw()
        to cell->draw() instead, it worked.

        Well, sort of, the correct row would turn yellow, but
        the previous row that was selected didn't redraw itself
        correctly, so it would probably need to be redrawn as well.

        In this case, you'd probably need to make a local copy of
        Fl_Table_Row, and rework it so that you do all the widget
        color()ing and redraw() logic in the event handler, rather
        than during actual drawing.

        Hope that points you in the right direction.

        Maybe what's needed is a callback() of some kind to Fl_Table_Row,
        so that it provides the needed hook for this kind of thing.
        Let me know what you find out..
        
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to