<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dynamic Items for Python Add In Wizard Combo Box in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/dynamic-items-for-python-add-in-wizard-combo-box/m-p/196466#M15050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am pretty new to python, and I'm sure I am getting a little ahead of myself by attempting to put a combo box script together, but here is my question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm attempting to use the Python Add In Wizard in 10.1 to create a combo box, and I'd like to add a list of dynamic items to the dropdown.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I understand I'm supposed to delete the self.item = ["item1", "item2"] under def __init__(self):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but my question is this: which function would I set my dynamic item script to.&amp;nbsp; (According to the properties of the Combo Box class, I cannot place it under def __init__(self):....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Python Add In Wizard creates it's own script which you are supposed to edit, so the other functions it provides are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;__init__(self)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;onSelChange(self, selection)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;onEditChange(self, text)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;onFocus(self, focused)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;onEnter(self)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Refresh(self)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure if this makes much sense, but if it DOES make sense, then any help would be appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 May 2012 14:34:42 GMT</pubDate>
    <dc:creator>LaurenMarie</dc:creator>
    <dc:date>2012-05-03T14:34:42Z</dc:date>
    <item>
      <title>Dynamic Items for Python Add In Wizard Combo Box</title>
      <link>https://community.esri.com/t5/python-questions/dynamic-items-for-python-add-in-wizard-combo-box/m-p/196466#M15050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am pretty new to python, and I'm sure I am getting a little ahead of myself by attempting to put a combo box script together, but here is my question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm attempting to use the Python Add In Wizard in 10.1 to create a combo box, and I'd like to add a list of dynamic items to the dropdown.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I understand I'm supposed to delete the self.item = ["item1", "item2"] under def __init__(self):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but my question is this: which function would I set my dynamic item script to.&amp;nbsp; (According to the properties of the Combo Box class, I cannot place it under def __init__(self):....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Python Add In Wizard creates it's own script which you are supposed to edit, so the other functions it provides are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;__init__(self)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;onSelChange(self, selection)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;onEditChange(self, text)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;onFocus(self, focused)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;onEnter(self)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Refresh(self)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure if this makes much sense, but if it DOES make sense, then any help would be appreciated!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 May 2012 14:34:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dynamic-items-for-python-add-in-wizard-combo-box/m-p/196466#M15050</guid>
      <dc:creator>LaurenMarie</dc:creator>
      <dc:date>2012-05-03T14:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Items for Python Add In Wizard Combo Box</title>
      <link>https://community.esri.com/t5/python-questions/dynamic-items-for-python-add-in-wizard-combo-box/m-p/196467#M15051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you haven't figured it out or haven't received any response yet:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There is an example in the add-in help topic:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/combo_box/014p00000028000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;Creating an add-in combo box&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code in that examples populates the combo box when it gets the focus:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;self.items = []
for layer in layers:
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.items.append(layer.name)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Later, in any other method of the combo box (or of any other control - button/tool) if you want to add more item to the items list, use append to do so. To set a value in the current display you can use value property:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;combobox_id.value = "new item"
combox_id.refresh()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:48:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/dynamic-items-for-python-add-in-wizard-combo-box/m-p/196467#M15051</guid>
      <dc:creator>NobbirAhmed</dc:creator>
      <dc:date>2021-12-11T09:48:51Z</dc:date>
    </item>
  </channel>
</rss>

