Table of Contents

Class GuiComponent

Namespace
SapGui.Wrapper
Assembly
SapGui.Wrapper.dll

Base class for all SAP GUI scripting objects. Wraps the raw COM object and provides safe property access via late binding.

public class GuiComponent
Inheritance
GuiComponent
Derived
Inherited Members

Properties

Changeable

Whether this component accepts user input.

public bool Changeable { get; }

Property Value

bool

ComponentType

Parsed enum version of TypeName.

public SapComponentType ComponentType { get; }

Property Value

SapComponentType

Id

e.g. "wnd[0]/usr/txtRSYST-BNAME"

public string Id { get; }

Property Value

string

IsModified

Whether the component value has been changed since the last server round-trip.

public bool IsModified { get; }

Property Value

bool

Name

Accessibility name.

public string Name { get; }

Property Value

string

RawObject

The raw underlying COM object. Use only if you need access to a property not yet exposed by this wrapper.

public object RawObject { get; }

Property Value

object

Text

Gets or sets the Text property of this component. Works on text fields, buttons, labels, combo boxes, status bars, etc. Equivalent to VBA: session.findById("...").Text = "value"

public virtual string Text { get; set; }

Property Value

string

Tooltip

Screen tooltip / short description.

public string Tooltip { get; }

Property Value

string

TypeName

e.g. "GuiTextField"

public string TypeName { get; }

Property Value

string

Methods

GetBool(string)

Reads a boolean property from the underlying COM object via late binding.

protected bool GetBool(string property)

Parameters

property string

COM property name, e.g. "Changeable".

Returns

bool

GetChildAtRaw(int)

Returns a child by its integer index from the component's Children collection.

protected object? GetChildAtRaw(int index)

Parameters

index int

Returns

object

GetChildrenRaw()

Returns the raw COM child collection object (GuiComponentCollection). Use FindById(string) for most navigation scenarios.

protected object? GetChildrenRaw()

Returns

object

GetInt(string)

Reads an integer property from the underlying COM object via late binding.

protected int GetInt(string property)

Parameters

property string

COM property name, e.g. "RowCount".

Returns

int

GetString(string)

Reads a string property from the underlying COM object via late binding.

protected string GetString(string property)

Parameters

property string

COM property name, e.g. "Text".

Returns

string

Invoke(string, params object[])

Invokes a method on the underlying COM object via late binding.

protected object? Invoke(string method, params object[] args)

Parameters

method string

COM method name, e.g. "Press".

args object[]

Arguments to pass to the method.

Returns

object

Press()

Clicks / activates this component (calls the COM Press method). Works on buttons and toolbar entries. Equivalent to VBA: session.findById("...").Press()

public virtual void Press()

RebindRaw(object)

Replaces the underlying COM object held by this wrapper. Used by components that need to re-fetch their COM reference after SAP re-renders the screen (e.g. GuiTable after a scroll).

protected void RebindRaw(object newRaw)

Parameters

newRaw object

Refresh()

Re-fetches the underlying COM object from SAP and rebinds this wrapper to it. Useful after SAP re-renders the screen (e.g. after scrolling a GuiTable). Only works when this instance was obtained via a typed session accessor (e.g. session.Table(id)) that stores the component ID.

public void Refresh()

SetFocus()

Moves keyboard focus to this component.

public virtual void SetFocus()

SetProperty(string, object)

Sets a property on the underlying COM object via late binding.

protected void SetProperty(string property, object value)

Parameters

property string

COM property name.

value object

New value.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.