Jeff Paranich wrote:
> From what I understand, Fl_Table_Row does not have the provision
> to select a row with a selection color, and then select a range
> of columns within that row with a different color.
Right; Fl_Table_Row as the name implies shows how to manage
rows, not columns, and with single selections only.
However, if you copy the code and modify it, you can use
the same techniques it does to get what you want.
Thing of Fl_Table_Row as a demonstration on how to use Fl_Table
to handle row selections.
> However, due to - what I suspect - is a delay in the redrawing
> of the table, I can temporarily do so (via a handled shortcut key),
> and this is okay for my needs. However my technique seems to
> only work from column 1 to column 'y' of the table, and not column 'x' to
> column 'y'.
>
> An example of the table with multiple colors:
> http://db.tt/FFmO9hj
Note that in your draw_cell() code you can color the cells
any way you want to show selections.
For instance, if you have variables in your derived class
to represent the row/col "selection rectangle", e.g.
// selection #1
col1_left, col1_right // defines left/right columns
of selection
row1_top, row1_bot // defines top/bottom rows of
selection
// selection #2
col2_left, col2_right // defines left/right columns
of selection
row2_top, row2_bot // defines top/bottom rows of
selection
..then your draw_cell() method can do this to properly draw
the two selections in the table:
fl_color(FL_WHITE); // default cell color
// SELECTION #1 COLOR
if ( COL >= col1_left && COL <= col1_right &&
ROW >= row1_top && ROW <= row1_bot ) {
fl_color(FL_GREEN);
}
// SELECTION #2 COLOR
if ( COL >= col2_left && COL <= col2_right &&
ROW >= row2_top && ROW <= row2_bot ) {
fl_color(FL_BLUE);
}
fl_rect(X,Y,W,H); // draw the cell bg color
[..draw data content here..]
Since you have full control over drawing what's in the cells, you
can do any kind of coloring you want, and have as many selections
as you want.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk