Hello,
I am trying to get a simple python code of when I click the button on my combobox toolbar, the button will direct the user to the next page in my Index(Map sheets).
This is my full code. I am only unable to get the onClick portion to not work, but I am very new at this so it could be affecting the rest of the code!
Any help would be greatly appreciated!
Thanks!
import arcpy
import pythonaddins
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
Layer = arcpy.mapping.ListLayers(mxd, "Index_2500", df)[0]
arcpy.SelectLayerByAttribute_management(Layer,"CLEAR_SELECTION")
class ButtonClass2(object):
"""Implementation for Index_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
arcpy.SelectLayerByAttribute_management(Layer,"CLEAR_SELECTION")
Next = combobox.value + 1
if len(Next) >=1:
arcpy.SelectLayerByAttribute_management(Layer, "NEW_SELECTION", + Next)
else:
pass
df.zoomToSelectedFeatures()
arcpy.RefreshActiveView()
class ComboBoxClass1(object):
"""Implementation for Index_addin.combobox (ComboBox)"""
def __init__(self):
if arcpy.mapping.ListLayers(mxd, "Index_2500") == []:
self.enabled = False
else:
self.editable = True
self.enabled = True
self.width = 'WWWWWW'
def onSelChange(self, selection):
pass
def onEditChange(self, text):
if len(text) >=1:
arcpy.SelectLayerByAttribute_management(Layer, "NEW_SELECTION", "Page = '" + text + "'")
else:
pass
def onEnter(self):
df.zoomToSelectedFeatures()
arcpy.RefreshActiveView()
text == ""
combobox.refresh()