Can't get Fl_Table to show?!?

35 views
Skip to first unread message

Mark McDougall

unread,
Jun 6, 2025, 10:07:03 AM6/6/25
to fltk.general
I have a class 'A' derived from Fl_Table. It implements (public) draw_cell() which in turn calls (protected, pure virtual) draw_cell_contents().

I then have classes 'B' and 'C', both derived from 'A'. They both implement (protected, virtual) draw_cell_contents().

If I instantiate B then C, only B is visible. If I instantiate C then B, only C is visible. They're both at different coordinates, non-overlapping. The debugger suggests both objects are being constructed in either case.

It's driving me nuts!!! Anyone seen this behaviour before? Any hints on how I can track the issue down???

TIA

Greg Ercolano

unread,
Jun 6, 2025, 1:22:49 PM6/6/25
to fltkg...@googlegroups.com
    Try to post a simple one-file program that shows the problem.
    Include your derived classes and remove any complexity not related to just drawing the table cells (e.g. no table data or fonts).

    In creating this small program you may find the problem, but if not, post the code and we'll be able to figure it out.

    Usually it's something simple, like an un-end()ed group, or a widget's xywh positions outside its parent, unbalanced push_clip/pop_clip, or some such.

    Since you mention instantiation order might be causing it, check carefully that you have explicit begin() and end() for each widget, as it kind sounds like an un-end()ed widget is absorbing other widgets created after it.

Greg Ercolano

unread,
Jun 6, 2025, 1:43:18 PM6/6/25
to fltkg...@googlegroups.com
Since you mention instantiation order might be causing it, check carefully that you have explicit begin() and end() for each widget, as it kind sounds like an un-end()ed widget is absorbing other widgets created after it.

    Keep in mind Fl_Table derives from Fl_Group, since it can also be used as a container for other widgets.

    So when you derive your widget from Fl_Table, be sure to end() each instantiation so it doesn't absorb other groups. e.g.

    MyTable *a = new MyTable(..);
    a->end();

    MyTable *b = new MyTable(..);
    b->end();


Mark McDougall

unread,
Jun 7, 2025, 8:51:30 AM6/7/25
to fltk.general
Wow, I was missing the end() and this fixed it! I don't think I was anywhere near picking that one up! 
Thank you, very much appreciated! 

pvr...@btinternet.com

unread,
Jun 7, 2025, 9:55:25 AM6/7/25
to fltk.general



Sent: Saturday, June 7, 2025 1:14 PM
To: fltk.general <fltkg...@googlegroups.com>
Subject: Re: [fltk.general] Can't get Fl_Table to show?!?
 
Wow, I was missing the end() and this fixed it! I don't think I was anywhere near picking that one up! 
Thank you, very much appreciated! 

A lesson quickly learned! If things don't draw as you expect, check you've got the end() in the right place.

Phil.

On Saturday, June 7, 2025 at 3:43:18 AM UTC+10 er...@seriss.com wrote:
Since you mention instantiation order might be causing it, check carefully that you have explicit begin() and end() for each widget, as it kind sounds like an un-end()ed widget is absorbing other widgets created after it.

    Keep in mind Fl_Table derives from Fl_Group, since it can also be used as a container for other widgets.

    So when you derive your widget from Fl_Table, be sure to end() each instantiation so it doesn't absorb other groups. e.g.

    MyTable *a = new MyTable(..);
    a->end();

    MyTable *b = new MyTable(..);
    b->end();


--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages