What I am trying to do is, when a button is pushed, it creates a new
listCtrl and move the cursor to the newly created Ctrl to be able to
edit it. WIth the code I have now, it adds the listCtrl fine, you can
click it edit it what have you but it will not go to it automaticly so
we can edit it without having to click on it. I thought that we could
use OpenEditor() but it gives me and error. I will include a snippet
and the trace:
#this is the function that is called when the button is pushed
def OnAdd(self, evt):
“”" Adds a new record to the window
“”"
newRec = [self.id]
#insted of adding random data we need to move the focus to the edit field after added
try:
for fields in range(0,self.editLst.
GetColumnCount()):
#add field names into the newly created row
newRec.append(self.databaseCol_Names[fields+1])
except:
print "error caught"
pass
#Add our new data to the database.
self.databaseData.append(newRec)
#Add the data in the columns, IE update the window
row = self.editLst.InsertStringItem(sys.maxint, newRec[1])
self.editLst.SetStringItem(row, 1, newRec[2])#row, column, object
self.editLst.SetItemData(row, newRec[0])
#Upadte the number of records
self.updateCount(len(self.databaseData))
[self.id](http://self.id/) = [self.id](http://self.id/) + 1
self.editLst.OpenEditor(0,0)
Traceback (most recent call last):
File “/Users/shadowghost21/Documents/pythonworkspace/etown/src/etown/python-src/editListWindow.py”, line 83, in OnAdd
self.editLst.OpenEditor(0,0)
File “//usr/local/lib/wxPython-unicode-2.8.9.1/lib/python2.5/site-packages/wx-2.8-mac-unicode/wx/lib/mixins/listctrl.py”, line 557, in OpenEditor
x0 = self.col_locs[col]
AttributeError: ‘Editlst’ object has no attribute ‘col_locs’
Just trying to figure out how to get this dang thing to do what I want ;p
Thanks guys,
Aaron