Problem with focus-in or focus-out event and GtkDialog

From: Date: Sun, 14 Jan 2007 22:14:54 +0000
Subject: Problem with focus-in or focus-out event and GtkDialog
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7556@lists.php.net to get a copy of this message
Hi , when I run thi code I've a crashes if I use alert function // check user input function on_focus_in_surname($widget) { alert ("focus is in "); print "Test focus in surname\n"; } all run well if I add a comment to alert //alert so I thik the problem is in GtkDialog Anyone has an idea about it? <?php $window = new GtkWindow(); $window->set_size_request(400, 150); $window->connect_simple('destroy', array('Gtk','main_quit')); $window->add($vbox = new GtkVBox()); $window->add_events(Gdk::FOCUS_CHANGE); // display title $title = new GtkLabel("Focus in Out tab from one to other field"); $title->modify_font(new PangoFontDescription("Times New Roman Italic 10")); $title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff")); $title->set_size_request(-1, 40); $vbox->pack_start($title, 0, 0); $name = new GtkEntry(); //$name->connect('focus-in-event', 'on_focus_in_name'); $name->connect('focus-out-event', 'on_focus_out_name'); $vbox->pack_start($name, 0, 0); $surname = new GtkEntry(); //$surname->connect('focus-in-event', 'on_focus_in_surname'); $surname->connect('focus-out-event', 'on_focus_out_surname'); $vbox->pack_start($surname, 0, 0); // check user input function on_focus_in_name($widget) { //alert ("focus is in "); print "Test focus in name\n"; } // check user input function on_focus_in_surname($widget) { //alert ("focus is in "); print "Test focus in surname\n"; } // check user input function on_focus_out_name($widget) { alert ("focus is out "); print "Test focus out name\n"; } // check user input function on_focus_out_surname($widget) { alert ("focus is out "); print "Test focus out surname\n"; } // display popup alert box function alert($msg) { // note 1 $dialog = new GtkDialog('Alert', null, Gtk::DIALOG_MODAL); // create a new dialog $dialog->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $top_area = $dialog->vbox; // note 2 $top_area->pack_start($hbox = new GtkHBox()); // note 3 $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG); // note 4 $hbox->pack_start($stock, 0, 0); // stuff in the icon $hbox->pack_start(new GtkLabel($msg)); // and the msg $dialog->add_button(Gtk::STOCK_OK, Gtk::RESPONSE_OK); // note 5 $dialog->set_has_separator(false); // don't display the set_has_separator $dialog->show_all(); // show the dialog $dialog->run(); // the dialog in action $dialog->destroy(); // done. close the dialog box. } $window->show_all(); Gtk::main(); ?> -- View this message in context: http://www.nabble.com/Problem-with-focus-in-or-focus-out-event-and-GtkDialog-tf3011422.html#a8363551 Sent from the Php - GTK - General mailing list archive at Nabble.com.

« previous php.gtk.general (#7556) next »