📚 SAP Business One SDK Help

ActiveItem Property
See Also  Example

Description

The unique ID of the item currently in focus on the form.

When you set this property, the form sets the focus on the specified item, which must be able to get focus (EditText or ComboBox).

Property type

Read-write property

Syntax

Visual Basic
Public Property ActiveItem() As String

Remarks

This property is set to an empty string if no item has the focus.

Throws a UIApiItemFormNotActive exception if the form is not active.

Throws an Item - Invalid item error if the item specified by csItemID does not exist on the form.

Example

Setting the focus (Visual Basic)Copy Code
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
    Dim oItem As SAPbouiCOM.Item
    Dim oComboBox As SAPbouiCOM.ComboBox
    oForm = SBO_Application.Forms.Item(FormUID)

    ' Get unique id of active item On form
    Dim activeItem As String = oForm.ActiveItem

    ' Set item With unique id To be active (In focus)
    oForm.ActiveItem = "Combo1"
    activeItem = oForm.ActiveItem ' Return UID of ComboBox

    ' Check a specific item ID is in focus
    Dim item As SAPbouiCOM.Item = oForm.Items.Item("Combo1")
    oComboBox = oItem.Specific

    Dim bActiveItem As Boolean = oComboBox.Active

    ' Remove focus from item (move focus to the next item that can get focus)
    oComboBox.Active = False
    bActiveItem = oComboBox.Active
End Sub

See Also