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 Library      Forums      Links      Apps     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 Greg Ercolano Nov 30, 2020  
 
On 2020-11-30 08:17, 'pvr...@btinternet.com' via fltk.general wrote:
Hi,

I am extending Fl_Table_Row to display records in a database. I would like to add the column header of the [rows]. Is this possible?

    Sure, be sure to turn on col_header(1) and then in your draw_cell(), add your code to the CONTEXT_COL_HEADER section
    to draw the text inside the cell area for that column# (the XYWH and COL values passed to you for those values respectively).

I tried to draw the text in draw_cell in the CONTEXT_STARTPAGE and CONTEXT_ENDPAGE, but neither did what I wanted. All I wanted to add was "Record No." or similar.

    The "CONTEXT_XXXPAGE" sections are just for drawing something over the entire table like a background, floating text, or some such.
    This is because the XYWH values at that time will be for the entire table, not any particular row/column or cell, which you'd need to know
    to draw each column's header.

    I suggest looking at the examples/table-simple.cxx example program, and look at how the A/B/C/D.. column headers are drawn, e.g.


  void draw_cell(TableContext context, int ROW=0, int COL=0, int X=0, int Y=0, int W=0, int H=0) {
    [..]
   
switch ( context ) {
      [..]
      case CONTEXT_COL_HEADER:                  // Draw column headers
        sprintf(s,"%c",'A'+COL);                // "A", "B", "C", etc.
        DrawHeader(s,X,Y,W,H);
        return;
        [..]



--
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/65d32c9f-72fc-6153-3ae9-5f44e80297a9%40seriss.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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