Back to TILs

C++ fltk — 4 — Multi window

Date: 2021-08-04Last modified: 2024-11-02

Table of contents

#include <FL/Fl.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Window.H>

void but_cb( Fl_Widget *, void * )
{
  auto win = new Fl_Window( 200, 100 );
  win->end();
  win->show();
  while( win->shown() ) {
    Fl::wait();
  }
}

int main()
{
  printf("FLTK\n");
  auto win    = new Fl_Window( 400, 300 );
  auto button = new Fl_Button( 160, 200, 80, 40, "Click" );
  win->end();
  win->show();
  button->callback( but_cb, NULL );
  return Fl::run();
}

Possible output

FLTK

References