> Two comments off the top of my head:
>
> The usual FLTK-1.3 idiom is to create your window/widget hierarchy
> from the top down, and let the implicit begin() in the constructor
> of Fl_Group derived widgets take care of adding lower level widgets
> in the correct place in the hierarchy, although you might have to
> explicitly call the corresponding end() method.
>
> It's also usual for the contents of a Fl_Group derived widget to be
> complete before you call resizable() so that it can work through all
> of its children to calculate which sizes need to be fixed and which
> can change.
>
> Don't know whether these are the cause of your problems though...

Third comment: not sure what happens if you remove a widget from
a resizable() group, resize the window, and then re-add the widget...

Anyway, the following simplification appears to work for me on Linux:

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

Fl_Window* window = 0;
Fl_Window* subwindow = 0;

static void ShowCB(Fl_Widget* widget, void* data)
{
    window->add(subwindow);
    subwindow->show();
    window->redraw();
}

static void HideCB(Fl_Widget* widget, void* data)
{
    subwindow->hide();
    window->remove(subwindow);
    window->redraw();
}

int main(int argc, char* argv[])
{
    window = new Fl_Window(512, 720);

    Fl_Button* showButton = new Fl_Button(30, 150, 452, 20, "Show console");
    showButton->callback(ShowCB);

    Fl_Button* hideButton = new Fl_Button(30, 180, 452, 20, "Hide console");
    hideButton->callback(HideCB);

    subwindow = new Fl_Window(0, 360, 512, 360);

    Fl_Text_Display* display = new Fl_Text_Display(30, 20, 452, 280);
    display->buffer(new Fl_Text_Buffer());

    Fl_Multiline_Input* input = new Fl_Multiline_Input(30, 300, 452, 20);

    subwindow->end();
    window->end();

    window->show(argc, argv);

    return Fl::run();
}

_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to