Function gtk_test::find_widget_by_name
source · pub fn find_widget_by_name<W: Clone + IsA<Object> + IsA<Widget>>(
parent: &W,
name: &str
) -> Option<Widget>
Expand description
Returns the child widget which has the given name.
Example:
extern crate gtk;
#[macro_use]
extern crate gtk_test;
use gtk::{Button, prelude::ContainerExt, prelude::WidgetExt, Window, WindowType};
gtk::init().expect("GTK init failed");
let but = Button::new();
let w = Window::new(WindowType::Toplevel);
but.set_widget_name("Button");
w.add(&but);
gtk_test::find_widget_by_name(&w, "Button").unwrap();