Select() for ListCtrl not same as mouse-click-select?

48 views
Skip to first unread message

Joel Burton

unread,
May 25, 2012, 3:11:54 PM5/25/12
to wxpytho...@googlegroups.com
I have a ListCtrl (REPORT_MODE and SINGLE_SEL). The user can click in this to highlight an entry in it and it appears reversed.

There are times where I want to change the selected entry programmatically. I can do this with:

    across_clues.Focus(idx)
    across_clues.Select(idx)

(the Focus() makes sure the selected item is currently scrolled to; the Select() selects it). 

This works, but the selection appearance is different here--it's only mildly highlighted with a light grey background.

Is there a way to programmatically choose the "mouse selection" appearance?

I've come across posts here that suggest you can select things with

    across_clues.SetItemState(idx, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)

But this just seems to do the same thing as list.Select(...)

(Mac OSX; 2.9, Carbon)

Thanks!
 
Screen Shot 2012-05-25 at 12.09.06 PM.png
Screen Shot 2012-05-25 at 12.09.16 PM.png

Robin Dunn

unread,
May 28, 2012, 4:20:08 PM5/28/12
to wxpytho...@googlegroups.com
Try calling SetFocus to move the actual system focus there. The generic
ListCtrl has a mode where the you can navigate the items with the
keyboard without changing the selected items, and the Focus() method
just sets that item to be the one where that navigation is currently
located. EnsureVisible is probably a better choice for making sure that
an item is scrolled into view.


--
Robin Dunn
Software Craftsman
http://wxPython.org

Reply all
Reply to author
Forward
0 new messages