Re: Help with modal dialog
- From: "Matthew A. Postiff" <postiffm comcast net>
- To: gtk-app-devel-list gnome org
- Subject: Re: Help with modal dialog
- Date: Thu, 21 Apr 2016 20:52:19 -0400
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")
delete syslogdialog;
syslogdialog = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]