On 04/21/2016 08:52 PM, Matthew A. Postiff wrote:
> I got farther by installing a signal handler that I catch in the
> container class/object. Now if I am viewing the dialog, and hit escape,
> it closes, the dialog is destroyed, and I can create it again later.
> 
> However, if I mouse click the Red X in the upper right corner of the
> dialog box (in Windows), the close routine is called, the dialog box
> container object is deleted and its pointer nullified, BUT the dialog
> box remains on screen.
> 
> What am I doing wrong?
> 
> void MainWindow::viewlog()
> {
>   if (!syslogdialog) {
>     DEBUG("Creating new System log dialog box")
>     syslogdialog = new SystemlogDialog(0);
>     // syslogdialog->getDialog() returns a GtkDialog *
>     // Attach a signal that knows how to handle closing this dialog.
>     g_signal_connect((gpointer)(syslogdialog->getDialog()),
> "close",        G_CALLBACK (on_close_system_log_activate), gpointer(this));
>     g_signal_connect((gpointer)(syslogdialog->getDialog()),
> "delete-event", G_CALLBACK (on_close_system_log_activate), gpointer(this));
>     syslogdialog->run();
>   }
>   else {
>       DEBUG("NOT creating new System log dialog box")
>       // Nothing else to do because the dialog already exists and is
> displaying
>       // on screen. If it ever comes to a point where that dialog is
> "lowered"
>       // to below the main window (which doesn't happen, I guess because
> it is
>       // a dialog), then we would need to "raise" it or call its "grab
> focus"
>       // routine?
>   }
> }
> 
> // A static method
> void MainWindow::on_close_system_log_activate(GtkDialog *dlg, gpointer
> user_data)
> {
>   // I'm guessing dlg == syslogdialog
>   ((MainWindow *) user_data)->on_close_system_log();
> }
> 
> void MainWindow::on_close_system_log()
> {
>   DEBUG("Destroying system log dialog")

syslogialog->close() or syslogdialog->hide()
OR if you extended GtkDialog class with your won dialog class BLAH,
then you could override the close method or on_close method() and call
::close() or ::hide() from there


>   delete syslogdialog;
>   syslogdialog = NULL;
> }


> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to