Clear dropdownlist Issues
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am starting my first fusion add-in and cannot get a dropdownlist to clear its contents.
I want to have a couple of dropdownlists, which dynamically update to reflect the user's selections. These dropdowns are:
1. A "section library" dropdown to choose from standard steel section libraries (i.e. hot rolled, welded, hollow etc.)
2. A "section type" dropdown to choose from more specific sections (i.e. square hollow, circular hollow)
3. A "section" dropdown to choose the specific section (i.e. "100x6 Square Hollow")
When the user changes their selections from a higher dropdown (1 or 2) the lower dropdowns should clear their contents and replace with the relevant options. However, I can't seem to get anything to work.
The following is the code I am using to try and clear the dropdowns:
for i in range(0, sect.listItems.count):
sect.listItems.item(0).isSelected = False
sect.listItems.item(0).deleteMe()
for i in range(0, secttype.listItems.count):
secttype.listItems.item(0).isSelected = False
secttype.listItems.item(0).deleteMe()
The following is a larger section of code from the InputChangedHandler. Note that the code for adding values to the dropdown lists works fine - i get ever expanding dropdown lists.
if changedInput.id == 'sectlib':
#if its the section library selection, update the section type box
for i in range(0, sect.listItems.count):
sect.listItems.item(0).isSelected = False
sect.listItems.item(0).deleteMe()
for i in range(0, secttype.listItems.count):
secttype.listItems.item(0).isSelected = False
secttype.listItems.item(0).deleteMe()
lib = sectlib.selectedItem.name
if lib != '':
#next add the libraries to sectlib
lines = readFile(getAddInFolder() + '\\Resources\\' + lib + '\\' + lib + '.txt')
if lines.count != 0:
for l in lines:
secttype.listItems.add(l,False)
elif changedInput.id == 'secttype':
#need to add sections to the section dropdown
#ClearList(sect).
for i in range(0, sect.listItems.count):
sect.listItems.item(0).isSelected = False
sect.listItems.item(0).deleteMe()
lib = sectlib.selectedItem.name
styp = secttype.selectedItem.name
if lib !='' and styp !='':
lines = readFile(getAddInFolder()+'\\Resources\\' + lib + '\\' + styp + '\\' + styp + '.txt')
if lines.count != 0:
for l in lines:
sect.listItems.add(l, False)