pub trait GuiContainerMethods<T: GuiComponentMethods = Self>: GuiComponentMethods<T> {
    // Provided methods
    fn find_by_id<S>(&self, id: S) -> Result<SAPComponent>
       where S: AsRef<str> { ... }
    fn children(&self, n: u32) -> Result<GuiSession> { ... }
}
Expand description

This interface resembles GuiVContainer. The only difference is that it is not intended for visual objects but rather administrative objects such as connections or sessions. Objects exposing this interface will therefore support GuiComponent but not GuiVComponent. GuiContainer extends the GuiComponent Object.

Provided Methods§

source

fn find_by_id<S>(&self, id: S) -> Result<SAPComponent>where S: AsRef<str>,

Search through the object’s descendants for a given id. If the parameter is a fully qualified id, the function will first check if the container object’s id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found the function raises an exception.

Examples found in repository?
examples/simple.rs (line 42)
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
fn main() -> Result<()> {
    // Initialise the environment.
    let com_instance = SAPComInstance::new()?;
    eprintln!("Got COM instance");
    let wrapper = com_instance.sap_wrapper()?;
    eprintln!("Got wrapper");
    let engine = wrapper.scripting_engine()?;
    eprintln!("Got scripting engine");
    let connection = engine.get_connection(0)?;
    eprintln!("Got connection");
    let session = connection.children(0)?;
    eprintln!("Got session");
    if let SAPComponent::GuiMainWindow(wnd) = session.find_by_id("wnd[0]")? {
        wnd.maximize().unwrap();

        if let SAPComponent::GuiOkCodeField(tbox_comp) =
            session.find_by_id("wnd[0]/tbar[0]/okcd")?
        {
            tbox_comp.set_text("/nfpl9").unwrap();
            wnd.send_vkey(0).unwrap();
        } else {
            panic!("no ok code field!");
        }
    } else {
        panic!("no window!");
    }

    Ok(())
}
source

fn children(&self, n: u32) -> Result<GuiSession>

This collection contains all direct children of the object.

Examples found in repository?
examples/simple.rs (line 40)
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
fn main() -> Result<()> {
    // Initialise the environment.
    let com_instance = SAPComInstance::new()?;
    eprintln!("Got COM instance");
    let wrapper = com_instance.sap_wrapper()?;
    eprintln!("Got wrapper");
    let engine = wrapper.scripting_engine()?;
    eprintln!("Got scripting engine");
    let connection = engine.get_connection(0)?;
    eprintln!("Got connection");
    let session = connection.children(0)?;
    eprintln!("Got session");
    if let SAPComponent::GuiMainWindow(wnd) = session.find_by_id("wnd[0]")? {
        wnd.maximize().unwrap();

        if let SAPComponent::GuiOkCodeField(tbox_comp) =
            session.find_by_id("wnd[0]/tbar[0]/okcd")?
        {
            tbox_comp.set_text("/nfpl9").unwrap();
            wnd.send_vkey(0).unwrap();
        } else {
            panic!("no ok code field!");
        }
    } else {
        panic!("no window!");
    }

    Ok(())
}

Implementors§