Trait sap_scripting::traits::GuiVComponentMethods
source · pub trait GuiVComponentMethods<T: GuiComponentMethods = Self>: GuiComponentMethods<T> {
Show 20 methods
// Provided methods
fn set_focus(&self) -> Result<()> { ... }
fn visualize(&self, on: bool) -> Result<()> { ... }
fn acc_text(&self) -> Result<String> { ... }
fn acc_text_on_request(&self) -> Result<String> { ... }
fn acc_tooltip(&self) -> Result<String> { ... }
fn changeable(&self) -> Result<bool> { ... }
fn default_tooltip(&self) -> Result<String> { ... }
fn height(&self) -> Result<i64> { ... }
fn icon_name(&self) -> Result<String> { ... }
fn is_symbol_font(&self) -> Result<bool> { ... }
fn left(&self) -> Result<i64> { ... }
fn modified(&self) -> Result<bool> { ... }
fn parent_frame(&self) -> Result<GuiComponent> { ... }
fn screen_left(&self) -> Result<i64> { ... }
fn screen_top(&self) -> Result<i64> { ... }
fn text(&self) -> Result<String> { ... }
fn set_text<S>(&self, value: S) -> Result<()>
where S: AsRef<str> { ... }
fn tooltip(&self) -> Result<String> { ... }
fn top(&self) -> Result<i64> { ... }
fn width(&self) -> Result<i64> { ... }
}
Expand description
The GuiVComponent interface is exposed by all visual objects, such as windows, buttons or text fields. Like GuiComponent, it is an abstract interface. Any object supporting the GuiVComponent interface also exposes the GuiComponent interface. GuiVComponent extends the GuiComponent Object.
Provided Methods§
sourcefn set_focus(&self) -> Result<()>
fn set_focus(&self) -> Result<()>
This function can be used to set the focus onto an object. If a user interacts with SAP GUI, it moves the focus whenever the interaction is with a new object. Interacting with an object through the scripting component does not change the focus. There are some cases in which the SAP application explicitly checks for the focus and behaves differently depending on the focused object.
sourcefn visualize(&self, on: bool) -> Result<()>
fn visualize(&self, on: bool) -> Result<()>
Calling this method of a component will display a red frame around the specified component if the parameter on is true. The frame will be removed if on is false. Some components such as GuiCtrlGridView support displaying the frame around inner objects, such as cells. The format of the innerObject string is the same as for the dumpState method.
sourcefn acc_text_on_request(&self) -> Result<String>
fn acc_text_on_request(&self) -> Result<String>
An additional text for accessibility support.
sourcefn acc_tooltip(&self) -> Result<String>
fn acc_tooltip(&self) -> Result<String>
An additional tooltip text for accessibility support.
sourcefn changeable(&self) -> Result<bool>
fn changeable(&self) -> Result<bool>
An object is changeable if it is neither disabled nor read-only.
sourcefn default_tooltip(&self) -> Result<String>
fn default_tooltip(&self) -> Result<String>
Tooltip text generated from the short text defined in the data dictionary for the given screen element type.
sourcefn icon_name(&self) -> Result<String>
fn icon_name(&self) -> Result<String>
If the object has been assigned an icon, then this property is the name of the icon, otherwise it is an empty string.
sourcefn is_symbol_font(&self) -> Result<bool>
fn is_symbol_font(&self) -> Result<bool>
The property is TRUE if the component’s text is visualized in the SAP symbol font.
sourcefn modified(&self) -> Result<bool>
fn modified(&self) -> Result<bool>
An object is modified if its state has been changed by the user and this change has not yet been sent to the SAP system.
sourcefn parent_frame(&self) -> Result<GuiComponent>
fn parent_frame(&self) -> Result<GuiComponent>
If the control is hosted by the Frame object, the value of the property is this frame. Overwise NULL.
sourcefn screen_left(&self) -> Result<i64>
fn screen_left(&self) -> Result<i64>
The y position of the component in screen coordinates.
sourcefn screen_top(&self) -> Result<i64>
fn screen_top(&self) -> Result<i64>
The x position of the component in screen coordinates.
sourcefn text(&self) -> Result<String>
fn text(&self) -> Result<String>
The value of this property very much depends on the type of the object on which it is called. This is obvious for text fields or menu items. On the other hand this property is empty for toolbar buttons and is the class id for shells. You can read the text property of a label, but you can’t change it, whereas you can only set the text property of a password field, but not read it.
sourcefn set_text<S>(&self, value: S) -> Result<()>where
S: AsRef<str>,
fn set_text<S>(&self, value: S) -> Result<()>where S: AsRef<str>,
The value of this property very much depends on the type of the object on which it is called. This is obvious for text fields or menu items. On the other hand this property is empty for toolbar buttons and is the class id for shells. You can read the text property of a label, but you can’t change it, whereas you can only set the text property of a password field, but not read it.
Examples found in repository?
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(())
}