View Full Version : Cancel the X button!
January 5th, 2007, 11:47 PM
Anyone know how to cancel the clode action when usr clicks X?
I need to stop it so I can redirect it to another void before closing.
January 6th, 2007, 12:12 AM
January 6th, 2007, 12:19 AM
I just forgot to mention, gtkmm 2.4 ;)
I also need to know how to change the function of the maximize button.
January 6th, 2007, 12:41 AM
Well I don't know exactly how to do it with gtkmm but I can outline the steps.
You need to set up so that when user clicks X something will be called. If you are using glade this is easy select the window and add signal delete_event in the signals tab.
Not sure how to do it in gtkmm without glade. (In perl it looked like this: $window->signal_connect(delete_event => \&delete_event); )
The function that takes care of delete_event needs to return a boolean, TRUE and the window will not close and you can do your stuff then exit however you want.
This is how it worked with perl anyway... hope it helps!
January 6th, 2007, 12:47 AM
Anyone else know? I am lost.
January 6th, 2007, 02:42 AM
You should give more information.
As Engnome mentioned, do you use Glade?
January 6th, 2007, 06:19 AM
If I remember right (which I might not), if your window is a child of Gtk::Window all you should have to do is override the on_delete_event() function. The maximize one I can't say I rightly know.
January 6th, 2007, 07:11 AM
Hmm, if I use a deconstructor(class_s::~class_a), I am trying to show a dialog, but if I do that << then it like hides the entire form then shows the dialog which I dont want, I want it to cancel all delete functions untill I tell it to delete.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.