El 24/11/20 a las 14:31, david allen escribió:
> My impression is that clicking X in the title bar executes the
> window's destructor, but that does not seem to be the case for a popup
> window. In the attached demo the intent is for clicking the X has the
> same effect as clicking the close button. It appears that the
> destructor is never called.
>
Indeed. That seems to be the case. You can fix it by attaching the
callback to window instead, like:
PopUPWin::PopUPWin(int x, int y, int w, int h, const char* label):
Fl_Double_Window(x, y, w, h, label)
{
hide();
set_modal();
show();
begin();
button = new Fl_Button(x+10, y+10, 100, 30, "Close");
end();
button->callback(close_CB, this);
callback( close_CB, this ); // new line
}