I'm using wxPython 2.8.11.0 with Python 2.5.4 (windows XP)
I have a simple wx.ListCtrl which contains 3 items. That means my
wx.ListCtrl is not full and I have a "space" under my last item.
If I clic on one of my item I get a wx.EVT_LIST_ITEM_SELECTED. If I
CTRL+clic on the same item, I get a wx.EVT_LIST_ITEM_DESELECTED event.
With these two events, I can know if an item is selected or not. But
if I clic on the "free space" inside my wx.ListCtrl (under the latest
item), the active item is deactivated but none event are sent.
I tried to catch "LEFT_DOWN" but this event is sent "too early" (the
item is still acvitaved) and my wx.ListCtrl does not send LEFT_UP
event (I thought I could handle this here, but with no success).
I tried on the "Demo" and the "normal ListCtrl works perfectly. In fact I forgot to say that my listCtrl is a virtual one (sorry).
On this specific case, the DESELECTED event is not sent. If you try the Demo "ListCtrl_virtual" and clic on an item, the message "OnItemSelected; ..." is written correctly. Clic after the latest column or after the latest row and no text is displayed on the Demo log Messages.
Sebastien
···
Le 22 juil. 2010 à 17:25, Matthias a écrit :
Am 22.07.2010, 11:09 Uhr, schrieb DarkScytale <sebastien.vinot@prevention-informatique.fr>:
Hello,
I'm using wxPython 2.8.11.0 with Python 2.5.4 (windows XP)
I have a simple wx.ListCtrl which contains 3 items. That means my
wx.ListCtrl is not full and I have a "space" under my last item.
If I clic on one of my item I get a wx.EVT_LIST_ITEM_SELECTED. If I
CTRL+clic on the same item, I get a wx.EVT_LIST_ITEM_DESELECTED event.
With these two events, I can know if an item is selected or not. But
if I clic on the "free space" inside my wx.ListCtrl (under the latest
item), the active item is deactivated but none event are sent.
I've tried modified the wxPython ListCtrl demo under Win7 and could not reproduce the issue there. Deselect events are fired if you click the empty area. Are you sure you are not missing an evt.Skip() somewhere?
If you still encounter a problem, please attach a small sample reproducing your problem.
I was able to reproduce your problem with virtual mode.
I've googled for "wxListCtrl virtual deselected" and a whole slew of messages popped up. This bug/missing feature has also been reported numerous times on the wxWidgets trac, one example is this: wxTrac has been migrated to GitHub Issues - wxWidgets .
So I guess you really need some workaround. Binding LEFT_UP as you suggested does not work for me either :(. As a hack I tried to bind EVT_LIST_CACHE_HINT and it gets fired indeed when items are deselected, so you could try to hook that one.
Somebody more knowledgeable (e.g. Robin) can probably shed more lights on this.
-Matthias
···
Am 22.07.2010, 17:56 Uhr, schrieb VINOT Sébastien <sebastien.vinot@prevention-informatique.fr>:
Well,
I tried on the "Demo" and the "normal ListCtrl works perfectly. In fact I forgot to say that my listCtrl is a virtual one (sorry).
I did not googled because I was first sure the problem came from my code
Thanks for these clues, I will try with "CACHE_HINT".
Sebastien
···
Le 22 juil. 2010 à 18:35, Matthias a écrit :
Am 22.07.2010, 17:56 Uhr, schrieb VINOT Sébastien <sebastien.vinot@prevention-informatique.fr>:
Well,
I tried on the "Demo" and the "normal ListCtrl works perfectly. In fact I forgot to say that my listCtrl is a virtual one (sorry).
I was able to reproduce your problem with virtual mode.
I've googled for "wxListCtrl virtual deselected" and a whole slew of messages popped up. This bug/missing feature has also been reported numerous times on the wxWidgets trac, one example is this: wxTrac has been migrated to GitHub Issues - wxWidgets .
So I guess you really need some workaround. Binding LEFT_UP as you suggested does not work for me either :(. As a hack I tried to bind EVT_LIST_CACHE_HINT and it gets fired indeed when items are deselected, so you could try to hook that one.
Somebody more knowledgeable (e.g. Robin) can probably shed more lights on this.
The general rule about virtual listctrls is that they will not send events for things that could possibly take a very long time because the control could possibly have a very large number of items. For example, lets say that you have a listctrl with a billion items in it, and that you have selected half of them (scroll to the middle of the list, click, scroll to the end, shift-click.) Now if you click past the end there will be 500 million deslections and if the listctrl sent an event for every one of them then you would be waiting a very long time, even if you didn't bind the handler yourself.
···
On 7/22/10 9:35 AM, Matthias wrote:
Am 22.07.2010, 17:56 Uhr, schrieb VINOT S�bastien > <sebastien.vinot@prevention-informatique.fr>:
Well,
I tried on the "Demo" and the "normal ListCtrl works perfectly. In
fact I forgot to say that my listCtrl is a virtual one (sorry).
I was able to reproduce your problem with virtual mode.
I've googled for "wxListCtrl virtual deselected" and a whole slew of
messages popped up. This bug/missing feature has also been reported
numerous times on the wxWidgets trac, one example is this: wxTrac has been migrated to GitHub Issues - wxWidgets .
So I guess you really need some workaround. Binding LEFT_UP as you
suggested does not work for me either :(. As a hack I tried to bind
EVT_LIST_CACHE_HINT and it gets fired indeed when items are deselected,
so you could try to hook that one.
Somebody more knowledgeable (e.g. Robin) can probably shed more lights
on this.
I'm considering modifying this behavior for the AGW UltimateListCtrl -
possibly having some kind of selection range event which takes care
of this problem.
···
The general rule about virtual listctrls is that they will not send
events for things that could possibly take a very long time because the
control could possibly have a very large number of items. For example,
lets say that you have a listctrl with a billion items in it, and that
you have selected half of them (scroll to the middle of the list, click,
scroll to the end, shift-click.) Now if you click past the end there
will be 500 million deslections and if the listctrl sent an event for
every one of them then you would be waiting a very long time, even if
you didn't bind the handler yourself.
I have been thinking of trying to use an image, bitmap or whatever, as a background for a control, the control will need to have several elements that should obviously be laid out in a sizer but I have not seen anything in the documents about setting a background image. Presumably I can just have a panel with a Client DC that is not in the sizer and the remainder of the controls in the sizer but I was wondering if that is really the way to go?
Thanks for the interpretation. I'd like to know that during the "deactivation process" for a virtual list, the list is propably calling a function that I can override in order to "know" something happens.
My problem is that my interface has buttons for editing the selected line. And without the "deselected" event, I cannot deactivate my buttons
Sebastien
···
Le 23 juil. 2010 à 03:34, Robin Dunn a écrit :
On 7/22/10 9:35 AM, Matthias wrote:
Am 22.07.2010, 17:56 Uhr, schrieb VINOT Sébastien >> <sebastien.vinot@prevention-informatique.fr>:
Well,
I tried on the "Demo" and the "normal ListCtrl works perfectly. In
fact I forgot to say that my listCtrl is a virtual one (sorry).
I was able to reproduce your problem with virtual mode.
I've googled for "wxListCtrl virtual deselected" and a whole slew of
messages popped up. This bug/missing feature has also been reported
numerous times on the wxWidgets trac, one example is this: wxTrac has been migrated to GitHub Issues - wxWidgets .
So I guess you really need some workaround. Binding LEFT_UP as you
suggested does not work for me either :(. As a hack I tried to bind
EVT_LIST_CACHE_HINT and it gets fired indeed when items are deselected,
so you could try to hook that one.
Somebody more knowledgeable (e.g. Robin) can probably shed more lights
on this.
The general rule about virtual listctrls is that they will not send events for things that could possibly take a very long time because the control could possibly have a very large number of items. For example, lets say that you have a listctrl with a billion items in it, and that you have selected half of them (scroll to the middle of the list, click, scroll to the end, shift-click.) Now if you click past the end there will be 500 million deslections and if the listctrl sent an event for every one of them then you would be waiting a very long time, even if you didn't bind the handler yourself.
There's an example of setting a background image on a panel here:
That should get you started.
···
On Jul 23, 2:02 am, <GadgetSt...@live.co.uk> wrote:
Hi,
I have been thinking of trying to use an image, bitmap or whatever, as a
background for a control, the control will need to have several elements
that should obviously be laid out in a sizer but I have not seen anything in
the documents about setting a background image. Presumably I can just have
a panel with a Client DC that is not in the sizer and the remainder of the
controls in the sizer but I was wondering if that is really the way to go?
Just for information, handling EVT_LIST_CACHE_HINT works and I can know if a line is active or none
Best regards
Sebastien.
···
Le 22 juil. 2010 à 18:35, Matthias a écrit :
Am 22.07.2010, 17:56 Uhr, schrieb VINOT Sébastien <sebastien.vinot@prevention-informatique.fr>:
Well,
I tried on the "Demo" and the "normal ListCtrl works perfectly. In fact I forgot to say that my listCtrl is a virtual one (sorry).
I was able to reproduce your problem with virtual mode.
I've googled for "wxListCtrl virtual deselected" and a whole slew of messages popped up. This bug/missing feature has also been reported numerous times on the wxWidgets trac, one example is this: wxTrac has been migrated to GitHub Issues - wxWidgets .
So I guess you really need some workaround. Binding LEFT_UP as you suggested does not work for me either :(. As a hack I tried to bind EVT_LIST_CACHE_HINT and it gets fired indeed when items are deselected, so you could try to hook that one.
Somebody more knowledgeable (e.g. Robin) can probably shed more lights on this.
Just draw the images as part of your control's EVT_PAINT handler. Or you can do it in the EVT_ERASE_BACKGROUND handler, but if you're going to be drawing other stuff in the control too then you may as well do it all in EVT_PAINT.
···
On 7/23/10 12:02 AM, GadgetSteve@live.co.uk wrote:
Hi,
I have been thinking of trying to use an image, bitmap or whatever, as a
background for a control, the control will need to have several elements
that should obviously be laid out in a sizer but I have not seen
anything in the documents about setting a background image. Presumably I
can just have a panel with a Client DC that is not in the sizer and the
remainder of the controls in the sizer but I was wondering if that is
really the way to go?
I have been thinking of trying to use an image, bitmap or whatever, as a
background for a control, the control will need to have several elements
that should obviously be laid out in a sizer but I have not seen anything in
the documents about setting a background image. Presumably I can just have
a panel with a Client DC that is not in the sizer and the remainder of the
controls in the sizer but I was wondering if that is really the way to go?
Any thoughts will be appreciated.
Gadget/Steve
There's an example of setting a background image on a panel here:
Thank-you Mike,
That covers exactly what I was looking for.
Gadget/Steve
···
From: "Mike Driscoll" <kyosohma@gmail.com>
Sent: Friday, July 23, 2010 2:53 PM
To: "wxPython-users" <wxpython-users@googlegroups.com>
Subject: [wxPython-users] Re: Control with a background
On Jul 23, 2:02 am, <GadgetSt...@live.co.uk> wrote: