FLTK logo

RE: [fltk.general] Getting text into the top-left "cell" in Fl_Table_Row

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

RE: Getting text into the top-left "cell" in Fl_Table_Row "'Philip Rose' via fltk.general" Dec 01, 2020  
 

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.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/5fc6613f.1c69fb81.139f8.3b14SMTPIN_ADDED_BROKEN%40gmr-mx.google.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.