Hello,

This is a question for Greg E. but perhaps someone has come across this
before?

I am trying to build a Fl_TableGroup (derived from Fl_Table_Row). I'm
modelling it off of the widgettable example on Greg's FLTK website:
http://seriss.com/people/erco/fltk/Fl_Table

widgettable source:
http://seriss.com/people/erco/fltk/Fl_Table/widgettable.cxx


Everything is working except I am unable to show the selected row. I think
it has to do with some kind of redraw() issue.

In Fl_TableGroup::draw_cell(), I have the following:

        case CONTEXT_CELL:
        {
                int idx = R*cols() + C;
                if(idx < children())
                {
                        Fl_Widget *cell = child(idx);

                        if(row_selected(R))
                                cell->color(selection_color());
                        else if(R % 2 == 0)
                                cell->color(color());
                        else
                                cell->color((Fl_Color)246);
                        cell->redraw();
                }
                return;         // fltk handles drawing the widgets
        }

When I select a row, the colour is set to selection_color(). However, to see
the colour change I have minimise/restore the app (openSUSE 10.2, KDE). The
other way I have been able to see the selection colour is by clicking on
the row a second time or clicking any where on the table.

I have tried replacing cell->redraw() with Fl::redraw() and
Fl_Group::redraw() but neither of these did the trick.

Here is how I am populating the Fl_TableGroup in my app:
        table->cols(3);
        table->begin();
        {
                {(new Fl_Box(0,0, 0, 0, "/hello/world"))->box(FL_FLAT_BOX);}  
// R 0 C 0

                {(new Fl_Box(0,0, 0, 0, "12345"))->box(FL_FLAT_BOX);}         
// R 0 C 1

                { // R 0 C 2
                        Fl_Choice *o = new Fl_Choice(0,0,0,0);
                        o->down_box(FL_BORDER_BOX);
                        o->menu(menu_1);
                }

                {(new Fl_Box(0,0, 0, 0, "/foo/bar"))->box(FL_FLAT_BOX);}  // R 
1 C 0

                {(new Fl_Box(0,0, 0, 0, "9876"))->box(FL_FLAT_BOX);}         // 
R 1 C 1

                { // R 1 C 2
                        Fl_Choice *o = new Fl_Choice(0,0,0,0);
                        o->down_box(FL_BORDER_BOX);
                        o->menu(menu_1);
                }
        }
        table->end();
        table->rows(2);

The above configures the Fl_TableGroup to be a 2 x 3 grid. A row contains
two Fl_Box widgets and a Fl_Choice. Everything works (display, scrolling,
column/row resizing, etc.) except for changing the color() of the child
widgets.

Any ideas would be great!

Thanks,

-- 
Alvin
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to