Re: [wxpython-users] wx.ListCtrl(), Report Mode, Editing Columns
by Robin Dunn other posts by this author
May 10 2008 4:02PM messages near this date
Re: [wxpython-users] wx.ListCtrl(), Report Mode, Editing Columns
|
Re: [wxpython-users] wx.ListCtrl(), Report Mode, Editing Columns
Rich Shepard wrote:
> On Fri, 9 May 2008, Robin Dunn wrote:
>
> > So you should be using idx for your calls to GetItem.
>
> Robin,
>
> When I do this, all I get is the text for the first column. I've tried
> GetNextSelected(idx), but I believe that refers to the row and not the
> column within a given row.
While in the ListCtrl sample in the wxPython demo I hit F6 to bring up
the widget inspector. Making sure that the TestListCtrl item is
selected in the tree I type the following into the PyShell and get the
indicated results:
> >> obj.GetItem(2, 0).GetText()
u'Billy Joel'
> >> obj.GetItem(2, 1).GetText()
u'The River Of Dreams'
> >> obj.GetItem(2, 2).GetText()
u'Rock'
> >>
Seems to be working correctly to me.
>
> > Or you can not use in place editing but instead popup a dilog when an
> > item
> > in the list is activated (double clicked or Enter is pressed) that
> > contains the values to be edited. If the dialog is completed successfully
> > you can put the values back into the list ctrl.
>
> This is what I'm trying to do. Where I'm stuck is extracting all the
> column values so I can load them into a dialog for editing.
Perhaps a new way of addressing the problem would make more sense to
you. Instead of treating the wx.ListCtrl as the data store, think of it
as just the view and keep your data someplace else that is easier to
access. You can go all the way down this path and use the wx.ListCtrl
in wx.LC_VIRTUAL mode, where it will ask you for the data items as
needed for display, or you can still load the data into the ListCtrl at
the start but use the SetItemData method to associate a key back to your
main data structure with the item in the listctrl. Then when you get an
event you can get from the item in the listctrl to the data in the data
structure by using GetItemData to get the key. Then you'll just need to
remember to update the items in the listctrl when they are changed in
your data structure.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
_______________________________________________
wxpython-users mailing list
wxpython-users@[...].org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users
Thread:
Rich Shepard
Robin Dunn
Mike Driscoll
Rich Shepard
Rich Shepard
Robin Dunn
Rich Shepard
Robin Dunn
C M
C M
Mike Driscoll
Rich Shepard
Rich Shepard
Robin Dunn
Rich Shepard
|