ListCtrl selection problem

Hello,

I haven't tried your code since I don't have your Image module but I
wonder... have you read the relevant sections in the wiki?

1.2 Selecting Items Programmatically
and
1.3 Retrieve Currently Selected Indices in List Control
at
http://wiki.wxpython.org/index.cgi/ListControls

may help you for your set/get selection.

···

-----Original Message-----
From: Peter Damoc [mailto:pdamoc@gmx.net]
Sent: Monday, February 16, 2004 4:32 PM
To: wxPython-users@lists.wxwindows.org
Subject: Re: [wxPython-users] ListCtrl selection problem

Too much trouble with the threads :smiley:
I found a way without them...

Now the problem is again, selection:
Besides the fact that the selection algorithm that comes with ListCtrl
is
screwed I tried to implement some kind of getSelection/setSelection
mecanism... but it doesn't work...
I'm susspecting a problem in setSelection (lines 44-51)...

what am I doing wrong? or better yet... how to do it right? :smiley:

--
Peter Damoc
Hacker Wannabe

Hello,

I haven't tried your code since I don't have your Image module but I
wonder... have you read the relevant sections in the wiki?

You can get PIL (Image module is part of PIL) at
http://www.pythonware.com/products/pil/#pil114

1.2 Selecting Items Programmatically
and
1.3 Retrieve Currently Selected Indices in List Control
at
http://wiki.wxpython.org/index.cgi/ListControls

may help you for your set/get selection.

for getSelection I use the method provided by ListCtrlSelectionManagerMix, Robin did that part and getSelection works flowlessly. The bit with which I have problems is setSelection..... :(... the part done by me :wink:
the wiki page does not provide much help for setSelection.... I already done what they say (see line 49 of the source code)

Anyways I figure it out that if I remove the evt.Skip() (line 77) all returns to inocence... :smiley: probably the keypress is interpreted by ListCtrl as a deselection.

Now all that's left to fix is the screwy selection algorithm... any ideas as how could I do that?

···

On Mon, 16 Feb 2004 18:59:27 +0100, M. Vernier <vernie_m@epita.fr> wrote:

--
Peter Damoc
Hacker Wannabe