From: Alex T. <al...@tw...> - 2005-07-18 21:49:09
|
Schollnick, Benjamin wrote: >1) How do I find out what Row the user has highlighted? I know >GetSelectedString will return the text, but I'm interested in finding >out row #666 is selected. > > There's no PythonCard method to do this directly. You can use the wxPython methods (I stole / adopted this code from the components/multicolumn.py). I took the multicolumnexample in the samples directory, added a button called "which" and added the code below. It prints out the list of selected item row numbers - and then makes the row following the first selected one be (also) selected. > def on_which_mouseClick(self, event): > print self.components.theList.getStringSelection() > numitems = self.components.theList.GetSelectedItemCount() > itemidx = -1 > items = [] > for i in xrange(numitems) : > itemidx = self.components.theList.GetNextItem(itemidx, > wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED) > if itemidx == -1: > #Odd, selection changed? > break > items.append(itemidx) > print items > > itemidx = items[0] + 1 > self.components.theList.SetSelection(itemidx) > a) How do I set the active row back to 667 or after I reload the >list? > > > You'd need to (assuming you want to) first de-select the current selection, then select 667 as you want - something like for i in items: self.components.theList.SetSelection(i, 0) # second param 0 to deselect self.components.theList.SetSelection(667) >2) I have buttons on the custom dialog / MultiColumnList... But I would >like to activate the edit function if they double click on a row. I >thought it would be either on_Activate or on_ActivatedEvent but neither >of those seemed to work when I created a event handler. > > > What did the MessageWatcher say the event was ? It's itemActivated :-) >3) > > > Yes. -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.9.0/50 - Release Date: 16/07/2005 |