customize background color of cells in a Fl_Table

6 views
Skip to first unread message

Rodolfo

unread,
Nov 24, 2020, 12:27:41 PM11/24/20
to fltkg...@googlegroups.com
I'm trying to implement a Fl_Table, as a regular container of widgets, one widget per cell, based on examples/table-as-container.cxx

The cells draw themselves, as explained in the documentation, but I does not respect the background color I selected with cell->color(...) at the time of the cell creation.

Any idea on how to customize the background color of the cells?

Thanks in advance,
Rodolfo.

Greg Ercolano

unread,
Nov 24, 2020, 12:32:52 PM11/24/20
to fltkg...@googlegroups.com
    What widgets are you using for the cells?
    Make sure they have a background, and aren't transparent.

    Widgets like Fl_Input have a background, but widgets like Fl_Group, Fl_Box, and Fl_Widget by default use FL_NO_BOX,
    which means setting the color() has no effect since the box is transparent. If yours is such a case, be sure to set the
    widget's box() type to one of the FL_XXX_BOX values. Note that the FL_XXX_FRAME box types are also see-through;
    the only thing they draw is a frame.

    The reason for the FL_NO_BOX default is to ensure the default behavior of FLTK is to decrease unnecessary drawing,
    as often Fl_Group doesn't need to draw a background (to let the window's background show through), and in the case
    of Fl_Box, it's most often used for showing labels, and also don't need their own background.

Reply all
Reply to author
Forward
0 new messages