View previous topic :: View next topic |
Author |
Message |
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Thu Apr 19, 2007 8:57 am Post subject: Am I missing something (delete_event) |
|
|
I'm trying to check to see if the sourceBuffer has been modified before closing and prompting. It was rather easy on the close button that I added, but for that actual delete_event of the window, I'm using the following code:
Code: |
gboolean delete_event(Event event, Widget widget)
{
if (sourceBuffer.getModified() == true)
{
MessageDialog d = new MessageDialog(
this,
GtkDialogFlags.MODAL,
MessageType.QUESTION,
ButtonsType.YES_NO,
"The document has not been saved! Would you like to exit anyway?");
int response = d.run();
//d.hide();
if (response == ResponseType.GTK_RESPONSE_YES)
{
GtkD.exit(0);
return false;
}
else
{
return true;
}
}
else
{
GtkD.exit(0);
return false;
}
}
|
Yes, I've added the addOnDelete(&delete_event) to the main window. Am I missing something? I get the prompt if the sourceBuffer has been modified, but both YES and NO close the window.
Thanks! |
|
Back to top |
|
|
okibi
Joined: 04 Jan 2007 Posts: 170
|
Posted: Fri Apr 20, 2007 8:08 am Post subject: |
|
|
While this still puzzles me, I'm not TOO concerned as I just reworded the Dialog's question to ask if they would like to save prior to closing. If they say yes, it saves and then closes, so this isn't a big issue anymore.
However, was I still missing something? Did I not have the signals caught correctly? Any help would be appreciated! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|