To update the contents of a combo box from a button OnClicked callback, you use the PPGItem.UIItems property.
Here’s a simple example that shows how:
import win32com.client
from win32com.client import constants
null = None
false = 0
true = 1
def XSILoadPlugin( in_reg ):
in_reg.Author = "blairs"
in_reg.Name = "ComboTestPlugin"
in_reg.Major = 1
in_reg.Minor = 0
in_reg.RegisterProperty("ComboTest")
return true
def XSIUnloadPlugin( in_reg ):
strPluginName = in_reg.Name
return true
def ComboTest_Define( in_ctxt ):
oCustomProperty = in_ctxt.Source
oCustomProperty.AddParameter2("List",constants.siInt4,0,0,100,0,100,constants.siClassifUnknown,constants.siPersistable + constants.siKeyable)
return true
def ComboTest_DefineLayout( in_ctxt ):
oLayout = in_ctxt.Source
oLayout.Clear()
oLayout.AddEnumControl("List", ("chocolate", 0, "vanilla", 1, "strawberry", 2), "Flavor", constants.siControlCombo )
oLayout.AddButton("Update")
return true
def ComboTest_Update_OnClicked( ):
Application.LogMessage("ComboTest_Test_OnClicked called")
x = ("Coffee Heath Bar Crunch", 0, "Cherry Garcia", 1, "Dulce Delux", 2 )
PPG.PPGLayout.Item("List").UIItems = x
Application.LogMessage( PPG.PPGLayout.Item("List").UIItems )
PPG.Refresh()