GISGURU_001

I want to use the enter tab on the key board

Discussion created by GISGURU_001 on Aug 30, 2012
Please i want to be able to select a name from a drop down list of a combobox i created and i use to use the enter tab to set the process and not by just selecting the name. which of the following codes would i use? Thanks

import arcpy
import pythonaddins
import os
import datetime
arcpy.env.overwriteOutput = True

   
class SelectPlotComboBoxClass(object):
    """Implementation for SelectPlot_addin.combobox (ComboBox)"""
    def __init__(self):
        #self.items = ["item1", "item2"]
        OBJECTID = []
        for row in arcpy.SearchCursor("Parcels"):
            OBJECTID.append(row.TDPDetails)
        self.items = sorted(OBJECTID)
        self.editable = True
        self.enabled = True
        self.dropdownWidth = 'WWWWWWWWWWWWWWWWWWWWWWWWWW'
        self.width = 'WWWWWWWWWWWWWWWWW'
    def onSelChange(self, selection):
        
        mxd = arcpy.mapping.MapDocument("CURRENT")

        for df in arcpy.mapping.ListDataFrames(mxd):
            if df.name == "Layers":
                dfmain = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
            #if df.name == "DFINSET":
                #dfinset = arcpy.mapping.ListDataFrames(mxd, "DFINSET")[0]

        OBJECTID = []
        for row in arcpy.SearchCursor("Parcels"):
            OBJECTID.append(row.TDPDetails)

        for lyr in arcpy.mapping.ListLayers(mxd, "", dfmain):
            if lyr.name == "Parcels":
                #lyr.definitionQuery = '"TDPDetails"' + "=" + "'" + selection + "'"
                #for 
                arcpy.SelectLayerByAttribute_management("Parcels", "NEW_SELECTION", '"TDPDetails"' + "=" + "'" + selection + "'")
                arcpy.SelectLayerByLocation_management("GIS_Parcels", "HAVE_THEIR_CENTER_IN", "Parcels", "", "NEW_SELECTION")
                df.zoomToSelectedFeatures()
        mxd = arcpy.mapping.MapDocument("Current")
        df = arcpy.mapping.ListDataFrames(mxd)[0]
        arcpy.SelectLayerByLocation_management("Parcels", "HAVE_THEIR_CENTER_IN", "KWAGIS_Parcels", "", "NEW_SELECTION")
        fc = "Parcels"
        field = "TDP_Status"
        cursor = arcpy.SearchCursor(fc)
        for row in cursor:
            #row.getValue(field)
            vall = row.getValue(field)
            if vall == "GENERATED": 
                arcpy.ExecuteError()
                arcpy.SelectLayerByAttribute_management("Parcels", "CLEAR_SELECTION")
                arcpy.SelectLayerByAttribute_management("GIS_Parcels", "CLEAR_SELECTION")
                print "TDP ALREADY GENERATED"
            else:
                print "Please Wait......"

    def onEditChange(self, text):
        pass
    def onFocus(self, focused):
        pass
    def onEnter(self):
        pass
    def refresh(self):
        pass             
  

Thanks

Outcomes