How to add listbox in Python API ?

Hi,

I’m learning how to build a new API, but I can’t find the function as listbox just like the picture below.

listbox

I already try Selectionmanager but it doesn’t work. And the below is my code that I can show the label and button.

from vcCommand import * 
from vcApplication import * 

cmd = getCommand()

aa = cmd.createProperty(VC_REAL, 'Name')
message = cmd.createProperty(VC_STRING, "Message") 
company = cmd.createProperty(VC_REAL, 'Company')
sent_button = cmd.createProperty(VC_BUTTON, 'sent')

def OnStart():         
    sent_button.OnChanged = say_it       
    executeInActionPanel()

def say_it(arg):
    hProp = getProperty('Name')    
    print('Hello %d' %(hProp.Value))

addState(None)

Would anyone be able to point me in the right direction on this?

Hi,

You need to use step values to create a list box. Example below:

p = cmd.createProperty(VC_STRING, 'TextProperty', VC_PROPERTY_STEP)
p.StepValues = ['AAA', 'BBB', 'CCC']
p.Value = 'AAA'

This property looks like this on the action panel:

-k

Thanks Keke, I try it and it work.