FLTK logo

Re: [fltk.general] Does FLTK have a stacked widget?

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: Does FLTK have a stacked widget? Greg Ercolano Feb 07, 2023  
 
On 2/7/23 05:47, 'Mark' via fltk.general wrote:
I need a widget that manages a collection of one or more other widgets ("pages") just like a Tab widget does: but with no tabs. The reason for no tabs is because this widget is tall and narrow with about 8 "pages", so I want to provide navigation using a combobox (i.e., a Choice widget) above it rather than having tabs.

    Derive a parent class from Fl_Group that's called "pages". Inside that class
    add your Fl_Choice widget (e.g. at the top), and below that, for the rest of the space,
    create another Fl_Group child called 'pages' that will contain all the page content.

    If the pages are literally text, you can probably get away with just making that
    'pages' group a single instance of Fl_Text_Display, and when the Fl_Choice is changed,
    just set the display's text content to the apropriate page content.

    Or, if the pages each have different widgets in them, make each page a separate
    Fl_Group (or a class derived from Fl_Group) that contains the widgets of each page.
    Set the position of all those groups in the SAME position, and hide() all the ones except
    the one to be shown using show(). And whenever Fl_Choice is changed, just hide() all
    the children except the one to be shown, and call pages->redraw() to update the screen.

--
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/639e9f9a-2387-d525-e424-bc53e3ad3b26%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-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.