How to cancel out of propertylistbox

G’day Everyone,

How can I capture and process a user hitting cancel on a propertylistbox?

The situation is that I want to iterate through a bunch of objects and display their properties as a manual verification process. No problem there, however if the user picks a lot of surfaces (desirable), but then decides to stop checking, OK and Cancel behave the same.

Have I missed a rhinocommon way of achieving this?

regards,
Nick

Hi Nick,

If the user presses Cancel the method will return None, otherwise it will return the values:

import rhinoscriptsyntax as rs

items = ['a','b']
values = ['aa','bb']

choice = rs.PropertyListBox(items,values)

if choice == None : print 'cancel pressed'
if choice: 
    for item,value in zip(items,values):
        print item, ' = ' , value

-Willem

Thanks @Willem , I’ll give that a go.