📚 SAP Business One SDK Help

Item Object
See Also  Members  Example

Description

Represents an item in a form. The Item object is uniquely identified by its UniqueID property and holds all the data of the referenced form item.

Use the this object to set item properties such as size, string, location, etc and to get its specific item properties.

Remarks

Note that when adding new elements to a form, by default, the elements are positioned to the left-hand side of the first element. To position the elements correctly, set real values to the Item.Left and Item.Top properties.

The following restrictions apply to original SAP Business One items:

  • You cannot set the item's Editable property to Yes.
  • You cannot set the item's Visible property to Yes.
  • You cannot set the DataBind object properties connected to this item.

Example

Adding items to a form (Visual Basic)Copy Code
Public Sub AddItemsToForm()

    Dim oForm As SAPbouiCOM.Form
    Dim oItem As SAPbouiCOM.Item

    Dim oButton As SAPbouiCOM.Button

    '// add a new form
    Set oForm = SBO_Application.Forms.Add("SimpleForm", ft_Fixed)

    '// set the form properties
    oForm.Title = "Simple Form"
    oForm.Left = 400
    oForm.Width = 300
    oForm.Top = 100
    oForm.Height = 100

    '//*****************************************
    '// Adding Items to the form
    '// and setting their properties
    '//*****************************************

    '/**********************
    '// Adding an Ok button
    '//*********************

    '// We get automatic event handling for
    '// the Ok and Cancel Buttons by setting
    '// their UIDs to 1 and 2 respectively

    Set oItem = oForm.Items.Add("1", it_BUTTON)
    oItem.Left = 5
    oItem.Width = 65
    oItem.Top = 50
    oItem.Height = 19

    Set oButton = oItem.Specific

    oButton.Caption = "Ok"

    '//************************
    '// Adding a Cancel button
    '//***********************

    Set oItem = oForm.Items.Add("2", it_BUTTON)
    oItem.Left = 75
    oItem.Width = 65
    oItem.Top = 50
    oItem.Height = 19

    Set oButton = oItem.Specific

    oButton.Caption = "Cancel"

End Sub

See Also