ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> wxpython-users
wxpython-users
[wxpython-users] wx.ListCtrl(), Report Mode, Editing Columns
by Rich Shepard other posts by this author
May 9 2008 9:11AM messages near this date
Re: [wxpython-users] Can a group of radio buttons be used as a one-click selection ? | Re: [wxpython-users] wx.ListCtrl(), Report Mode, Editing Columns
Testing the item editing function for my 5-column list in report mode
throws error for which I have not found a solution in the wPIA book. In
subsection 13.4.1 (page 411) I learn, "[e]diting an entry in the list is
simple, except in report lists, where the user can only edit the first
column in each row." Sigh.

   The approach I tried is in this function (only the first part which
generates the error is reproduced; I'll deal with the rest when I get
there):

 	def OnRuleEdit(self, event):
           # copy contents of row for each column to variables
           row = self.itemID
           idx = self.rulesList.GetFirstSelected()
           pName = self.rulesList.GetItem(row, 0).GetText()
           sName = self.rulesList.GetItem(row, 1).GetText()
           vName = self.rulesList.GetItem(row, 2).GetText()
           rNo = self.rulesList.GetItem(row, 3).GetText()
           rTxt = self.rulesList.GetItem(row, 4).GetText()

   The python error is:

Traceback (most recent call last):
   File "/data1/eikos/rulePage.py", line 112, in OnRuleEdit
     pName = self.rulesList.GetItem(row, 0).GetText()
   File
"/usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_controls.py", line
4503, in GetItem
     val = _controls_.ListCtrl_GetItem(*args, **kwargs)
TypeError: in method 'ListCtrl_GetItem', expected argument 2 of type 'long'

which looks similar to the error I saw before correctly loading data into
the widget. But, I don't see how that solution applies here. When loading
values I need to get each column's value from a tuple of items in a list.
Here, to edit a displayed label, I need to capture the strings for each
column in the selected row to variables, load those into a dialog box, edit,
then re-display (with the changed label) and save.

   The selected row is correctly identified, but I'm stuck on how to get the
values from each column in that row.

Rich



-- 
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>      Voice: 503-667-4517      Fax: 503-667-8863
_______________________________________________
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved