[−][src]Function gtk_test::find_child_by_name
pub fn find_child_by_name<C: IsA<Widget>, W: Clone + IsA<Object> + IsA<Widget>>(
parent: &W,
name: &str
) -> Option<C>
Returns the child element which has the given name.
Example:
extern crate gtk; #[macro_use] extern crate gtk_test; use gtk::{prelude::BuildableExtManual, Button, ContainerExt, 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_child_by_name::<Button, Window>(&w, "Button").expect("failed to find child"); // Or even better: let but: Button = gtk_test::find_child_by_name(&w, "Button").expect("failed to find child");