Re: Problem with focus-in or focus-out event and GtkDialog
| From: | AngeloP | Date: | Thu, 18 Jan 2007 23:57:09 +0000 |
| Subject: | Re: Problem with focus-in or focus-out event and GtkDialog | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7562@lists.php.net to get a copy of this message | ||
I think to renounce to GtKMessage dialog to show errors messages or to drive
the
user ....
I use status bar to comunicate a message !!! In this way all goes well
<?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-out-event', 'on_focus_out_name');
$vbox->pack_start($name, 0, 0);
$surname = new GtkEntry();
$surname->connect('focus-out-event', 'on_focus_out_surname');
$vbox->pack_start($surname, 0, 0);
// Create a status bar.
$status = new GtkStatusbar();
$vbox->pack_start($status, 0, 0);
// check user input
function on_focus_out_name($widget) {
//alert ("focus is out name");
write_msg('focus is out name');
print "Test focus out name\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";
write_msg('focus is out suname');
return false;
}
$window->show_all();
Gtk::main();
function write_msg($msg){
global $status;
$context_id = $status->get_context_id('example');
$status->push($context_id, $msg);
}
?>
--
View this message in context: http://www.nabble.com/Problem-with-focus-in-or-focus-out-event-and-GtkDialog-tf3011422.html#a8441859
Sent from the Php - GTK - General mailing list archive at Nabble.com.