Richard Terry wrote:
If you have bound an event to a list eg:
self.bind(wx.EVT_LIST_ITEM_SELECTED,self.onRowSelected,
self.searchlist)
which would jumpt to a subroutine when the user clicked on a
row on the list:
def onRowSelected(self,evt):
dothenextthing
Is it possible to trigger the event in code to execute the
subroutine contents without the user clicking on the actual list?
Reason is in this situation is that I've a couple of linked
lists. When the first list contents contains only 1 item, I
want to automatically populate the second list without the
user having to click on it.
Thanks in anticipation of example, not just a 'yes'.
Here are two ideas.
1. def onRowSelected(self,evt):
self.dothenextthing()
def dothenextthing(self):
do whatever you want
To call the method programatically, just call self.dothenextthing()
2. def onRowSelected(self,evt=None):
dothenexthing
Now onRowSelected can be called directly as well as via an event.
My guess is that you have some logic to derive which row was selected before
you 'dothenextthing', whereas if you call it yourself, you know in advance
which row to use. If so, a variation on idea 1 may be the way to go -
def onRowSelected(self,evt):
row = evt.RowSelected() [I'm guessing at the syntax here]
self.dothenextthing(row)
def dothenextthing(self,row):
do whatever you want
Frank Millman