Function gtk_test::focus

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

Focus on the given widget.

Example:

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

use gtk::{Button, prelude::WidgetExt};
use gtk::glib::Propagation;

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

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