FLTK logo

Re: [fltk.general] Popup window distructor not being called

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: Popup window distructor not being called david allen Nov 24, 2020  
 

On Tuesday, November 24, 2020 at 12:40:01 PM UTC-5 ggar...@gmail.com wrote:

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
  }

Perfect. Thanks!

--
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/0dcf6313-26cd-4216-9fae-dc460ebab7f7n%40googlegroups.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'.