Re: Deactivate window close button
| From: | Gonzalo Monzón | Date: | Fri, 17 Sep 2004 20:02:32 +0000 |
| Subject: | Re: Deactivate window close button | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5095@lists.php.net to get a copy of this message | ||
Ernesto Quiñones A. escribió:
Hello Gonzalo only I need deactivate the windows destroy event show and hide my windows is ok ... my code is ok in this my aplicaciton is in a glade file, 15 windows +/- invoce form a php code thanks hola Gonzalo mi aplicacion funcion ok, solo quiero desactivar el boton de cerrar ventana ya que me destruye la clase que autogenera el php del glade odnde estan las ventanas dibujadas, me escribieron (no muy amablemente) con una solucion al respecto voy a tentar suerte con eso .. ojala funcione muchas gracias por tu ayuda saludos Gonzalo Monzón dijo:1. Debes cargar el objeto ventana en tu programa:Ernesto Quiñones A. escribió:Hola Ernesto, perdón por no responderte en castellano, pero la respuesta ya era correcta en todo caso pero seguro que poco comprensible. Haber si ahora te puedo ayudar, es muy sencillo:Hello friends i need deactivate the window close button (X) the problem is when a user press this button destroy the window class and only need hide the window to show this later any body can help me? thanks pd. excuse me my bad englishHi Ernesto! Are you speaking about you need to hide the window... is this the main or a children window? In any way you can create another Gtk:main() loop in a children window, so when delete event is called in the window and is closed, still there's the parent Gtk::main() so your program doesn't close and you can open again that child window later... All you need is to call Gtk::main(); again from your children window, then it can be destroyed using the close button, and later the parent window wich gots the first main loop (Gtk::main()), can re-call the class object for this window and it will be created again and wait until the main loop of the Gtk children window process (Gtk::main) is destroyed or terminated. Or if you minimize the child window, and close the parent, both will close. Or you can just catch the destroy and delete-event signals of the window and force them to do what you need (confirmation message, etc...) I hope this may help you, 'cause the solution you tell in your email of deactivating close button in your child window doesn't look to be the best... have you looked at popup windows? i think they have'nt the close button but now I don't remember exactly. So test it by yourself! Gonzalo Monzon -- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
$glade = &new GladeXml(APPDIR."disge_glade".F_SEP."tabla_cuentasbancarias_window.glade");
$window = $glade->get_widget('Tabla_CuentasBancarias_Window');
2. y capturar las señales que se disparan al cerrar la ventana: se conectan con la funcion end_main
$window->connect("destroy" , "end_main");
$window->connect("delete-event" , "end_main");
3. Iniciar el Gtk::main() desde alguna funcion o donde sea.
4. Definir la funcion a la que has conectado la ventana: Normalmente se saldría aquí del "main loop" iniciado antes en tu programa con Gtk::main(); En esta funcion pondriamos el Gtk::main_quit pues tambien la hemos conectado desde un botón así conectaríamos tambien su señal a la misma funcion (sino no sería necesario ejecutar el Gtk::main_quit() pues CREO que se ejecuta automaticamente al pulsar en el botón cerrar y por eso se te cierra siempre)
function end_main() {
Gtk::main_quit();} Pero en tu caso deberías llamar otra vez al Gtk::main(); para evitar que cierre la ventana : function end_main($quit=0) {
if ($quit==0) Gtk::main();
else Gtk::main_quit();
}
O mejor redirijirlo a la funcion donde se ejecute el Gtk::main() de tu programa:
function end_main() {
inicio_ventana();} Y así evitas que se cierre la ventana pues creo como te he dicho que Gtk::main_quit() siempre se ejecuta al pulsar en el boton cerrar, o almenos eso pienso. Sinó entrarías en un bucle infinito de gtk:main()'s ... prueba haber si te va bien mi solución, y sobre todo mirate la documentación. Un saludo desde España, And sorry for the people who could not understand this reply. Gonzalo Monzon