From: Greg Ercolano
Sent: 30 November 2020 23:43
To: fltkgeneral@googlegroups.com
Subject: Re: [fltk.general] Getting text into the top-left "cell" in Fl_Table_Row
On 2020-11-30 14:44, 'Philip Rose' via fltk.general wrote:
In the shown example, it’s the place to the left of where it says “Date” and above the place where it has “2925”. I would like to write into there.
Oh, that little area is neither cell nor header.. that's a perfect use for CONTEXT_ENDPAGE.
Here's how to write to that area, shown by drawing an "X":
case CONTEXT_ENDPAGE: { // after page headers/cells are drawn..
// Draw black 'x' in the dead area
int X1=x(), Y1=y(), X2=x()+row_header_width(), Y2=y()+col_header_height();
fl_color(FL_BLACK);
fl_line(X1,Y1,X2,Y2);
fl_line(X1,Y2,X2,Y1);
return;
}
Thanks Greg,
Looks like I had originally tried to display the text in the top-left of the window.
I had to tweak the code slightly to get the box to line up with the column headers:
case CONTEXT_ENDPAGE:
{
// Code trying to write text into the top-left corner
// Set the font for the header header
fl_font(fl_font() | FL_ITALIC, fontsize_);
// Set the col header row header crossing point
fl_color(col_header_color());
int X1 = x() + Fl::box_dx(box());
int Y1 = y() + Fl::box_dy(box());
int W1 = row_header_width();
int H1 = col_header_height();
fl_draw_box(FL_BORDER_BOX, X1, Y1, W1, H1, col_header_color());
// Text color
fl_color(FL_BLACK);
fl_draw("QSO No.", X1, Y1, W1, H1, FL_ALIGN_CENTER);
return;
}
Regards Phil.