Block UI Styler > Block Catalog > Basic > List Box
Registering Add and Delete callbacks for List Box
The List Box provides the following APIs to register callbacks for use with the Add and/or Delete buttons:
- SetAddHandler
- SetDeleteHandler
Note
You must register the callbacks for the Add and Delete buttons in initialize_cb, after the List Box instance is fetched — otherwise an error message is generated.
Example (VB.NET)
Public Sub initialize_cb()
Try
listBox0 = CType(theDialog.TopBlock.FindBlock("listBox0"), NXOpen.BlockStyler.ListBox)
listBox0.SetAddHandler(AddressOf addButtonEvent)
listBox0.SetDeleteHandler(AddressOf deleteButtonEvent)
Catch ex As Exception
'---- Enter your exception handling code here -----
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
End Sub
Function addButtonEvent(ByVal listBlock As BlockStyler.ListBox) As Integer
// User Implementation
Return 0
End Function
Function deleteButtonEvent(ByVal listBlock As BlockStyler.ListBox) As Integer
// User Implementation
Return 0
End Function
Notes
- The return value of the Add event handler function is unused.
- The return value of the Delete event handler function is used to negate the deletion (i.e., returning a non-zero/failure value can veto the delete).
Source: https://docs.sw.siemens.com/en-US/doc/209349590/PL20220512394070742.blockstyler/xid292839 · retrieved 2026-07-07