[gtkmm] Dialog: on_delete_event(GdkEventAny*)



Hi.
I want to prevent a dialog from being closed. Yes, there have been some
threads (also on other gtk related lists) about this topic, but I
couldn't find a solution that worked for me.
First, I want to prevent the dialog from being closed when the
user clicks on the frame's "X". The Gtk::Window doc says that this
could be done by overriting the on_delete_event handler. As the
Gtk::Dialog inherits from Gtk::Window, this shouldn't be a problem as I
thought. The code snippet:

class MyDialog : public Gtk::Dialog
{
private:
bool on_delete_event(GdkEventAny*);
void on_response(int);
}

bool MyDialog::on_delete_event(GdkEventAny*)
{
	cerr << "delete_event" << endl;
	return true;
}

void MyDialog::on_response(int response_id)
{
	cerr << "response: " << response_id << endl;
}

If I close the Dialog with the frame's "X", on_response gets called and
tells me that the response id is -4 (delete_event response), which is
what I expected, but on_delete_event doesn't get called.
What am I doing wrong? Any solution?

Regards,
Christian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]