[][src]Function gtk_test::focus

pub fn focus<W: Clone + IsA<Object> + IsA<Widget> + WidgetExt>(widget: &W)

Focus on the given widget.

Example:

extern crate gtk;
#[macro_use]
extern crate gtk_test;

use gtk::{Button, Inhibit, WidgetExt};

gtk::init().expect("GTK init failed");
let but = Button::new();

but.connect_focus(|_, _| {
    println!("focused!");
    Inhibit(false)
});
gtk_test::focus(&but);