[wxPython-users] Request to fix wx.ListCtrl.SetItemData()
Jorgen Bodde
jorgen.maillist at gmail.com
Mon May 7 13:38:12 PDT 2007
Hi Robin,
Thanks for the reply. I see what you mean. The
wxControlWithItems::SetClientData is a void* .. well AFAIK I long can
be safely casted to a void * .. I've done it many times, So maybe the
indirect pyobject -> void * -> long construction might be a solution
- Jorgen
On 5/7/07, Robin Dunn <robin at alldunn.com> wrote:
> Andrea Gavana wrote:
> > Hi Jorgen,
> >
> > On 5/7/07, Jorgen Bodde wrote:
> >> Could this be safely changed to a long? Or maybe if the existing API
> >> will break too much, reimplement this as wx.ListCtrl.SetItemDataLong()
> >> / wx.ListCtrl.SetClientData() ?
> >>
> >> It is a bit annoying to have to keep a dictionary reference to my
> >> objects, and come up with unique numbers to identify which object I
> >> clicked, while changing the int to a long in wx.ListCtrl.SetItemData
> >> () would allow us to pass object references to the GUI, and be more
> >> consistent with wx.Choice / wx.ComboBox and the likes, which do allow
> >> that.
> >
> > I agree with you, it is a bit annoying to notice that the powerful
> > wx.ListCtrl can not handle Python object data as, for example,
> > wx.TreeCtrl does (using SetPyData). From the point of view of
> > implementation, I don't think it will be that much problematic as it
> > is a Python specific modification that would require a couple of
> > methods (what about having SetPyData and GetPyData as wx.TreeCtrl
> > has?).
>
> It may be possible, but it is problematic. See my reply in the "Passing
> python object as client data" thread. It really needs some surgery in
> the wxListCtrl C++ classes to be done safely.
>
> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org Java give you jitters? Relax with wxPython!
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
More information about the wxpython-users
mailing list