FOCUS-IN-EVENT FOCUS-OUT-EVENT RUN WELL

From: Date: Fri, 19 Jan 2007 11:41:59 +0000
Subject: FOCUS-IN-EVENT FOCUS-OUT-EVENT RUN WELL
Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7563@lists.php.net to get a copy of this message
Here an examle <?php // display popup alert box function alert($msg) { $dialog = new GtkDialog('Alert', null, Gtk::DIALOG_MODAL); $dialog->set_position(Gtk::WIN_POS_CENTER_ALWAYS); $top_area = $dialog->vbox; $top_area->pack_start($hbox = new GtkHBox()); // note 3 $stock = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG); $hbox->pack_start($stock, 0, 0); $hbox->pack_start(new GtkLabel($msg)); $dialog->add_button(Gtk::STOCK_OK, Gtk::RESPONSE_OK); $dialog->set_has_separator(false); $dialog->show_all(); $dialog->run(); $dialog->destroy(); } // Write something into status bar function Status_Message($msg){ $context_id = $GLOBALS["status"] ->get_context_id('...'); $GLOBALS["status"]->push($context_id, $msg); } // ========================================================= $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_after('focus-in-event', 'on_focus_in_name'); $name->connect_after('focus-out-event', 'on_focus_out_name'); $vbox->pack_start($name, 0, 0); $surname = new GtkEntry(); $surname->connect_after('focus-in-event', 'on_focus_in_surname'); $surname->connect_after('focus-out-event', 'on_focus_out_surname'); $vbox->pack_start($surname, 0, 0); $status = new GtkStatusbar(); $vbox->pack_start($status, 1, 1); // check user input function on_focus_in_name($widget) { Status_Message('I get into the name...'); print "Test focus in name\n"; return false; } // check user input function on_focus_out_name($widget) { alert ("focus is out name"); print "Test focus out name\n"; return false; } // check user input function on_focus_in_surname($widget) { Status_Message('I get into the suname...'); print "Test focus in suname\n"; return false; } // check user input function on_focus_out_surname($widget) { alert ("focus is out surname.\nWait please I crash!!!"); print "Test focus out surname\n"; return false; } $window->show_all(); Gtk::main(); ?> -- View this message in context: http://www.nabble.com/FOCUS-IN-EVENT-FOCUS-OUT-EVENT-RUN-WELL-tf3039452.html#a8447704 Sent from the Php - GTK - General mailing list archive at Nabble.com.

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