Discussion:
wxListCtrl always has a selected item (wxGTK)
Деян Хаджиев
2014-05-11 21:07:48 UTC
Permalink
Hi,

I'm trying to migrate my projects from 2.8.12 to 3.0. In one of them I'm
using wxListCtrl as a read only list. I'm catching all necessary mouse
events and skipping its focus events and it works well on wxMSW. On wxGTK
however there seems to be some problem with the selection (it started from
the 3.0.0 builds). It seems that there is always a selected or more like
semi-selected item (only a dashed rectangle around it, the background is
the same as the deselected items). I tried to deselect all the items
manually with calls to wxListCtrl::SetItemState(..) but this doesn't seem
to work. Is there another way for achieving this or this is a bug from the
3.0?

Best regards
Deyan Hadzhiev
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Jan Engelhardt
2014-05-11 21:16:00 UTC
Permalink
[ListCtrl] It seems that there is always a selected or more like
semi-selected item (only a dashed rectangle around it, the background is the
same as the deselected items).
The dashed box indicates where the focus is; selection is when the
well-known background color shows. The two are independent, even
under Windows (try naviating a multi-selectable ListBox or similar
with Ctrl-Down or Ctrl-Up to see).
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Vadim Zeitlin
2014-05-14 15:07:33 UTC
Permalink
On Sun, 11 May 2014 14:07:48 -0700 (PDT) ДеяМ ХаЎжОев wrote:

ДХ> I'm trying to migrate my projects from 2.8.12 to 3.0. In one of them I'm
ДХ> using wxListCtrl as a read only list. I'm catching all necessary mouse
ДХ> events and skipping its focus events and it works well on wxMSW.

Why do you need to do this? wxListCtrl is read-only by default, if you
don't use wxLC_EDIT_LABELS, and you can restrict the user from selecting
more than one item by specifying wxLC_SINGLE_SEL and what exactly is wrong
with allowing this?

ДХ> It seems that there is always a selected or more like semi-selected
ДХ> item (only a dashed rectangle around it, the background is the same as
ДХ> the deselected items). I tried to deselect all the items manually with
ДХ> calls to wxListCtrl::SetItemState(..) but this doesn't seem to work. Is
ДХ> there another way for achieving this or this is a bug from the 3.0?

As Jan already wrote, this is the focused item and there is no way to get
rid of it, other than not giving focus to the control at all. But I really
can't recommend doing this, it's much better to just not do anything. In
particular, please notice that intercepting mouse and keyboard events for
native controls was never guaranteed to work and you really shouldn't be
doing this.

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Деян Хаджиев
2014-05-26 07:17:07 UTC
Permalink
Hi,

I needed to do this, because I wanted to have a ListCtrl widget, but only
for displaying information (for particular I needed to be able to show an
icon + text) and also I need to interactively change the showed content,
but I want no focus and selection of items.
I tried to remove the focus with SetItemState(itemIdx, 0,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED), but that didn't remove the
focus as well.
Maybe I should have implemented my own control from the beginning, but I
thought I could use something already implemented.

Best Regards
Deyan Hadzhiev
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Loading...