how to select a row in CtrlList, assign color to it

thanks in advance. I have tried to kill the bugs for several days, but
I found nothing useful
I have been nagged not to sleep well those days :frowning:

http://logistics4hell.googlepages.com/pack.zip is the code

what I want looks like http://logistics4hell.googlepages.com/iwant.gif :
1. the row is displayed in white-grey-white-... color, so make it easy
to read, that should be true when I delete a row
2. there is always one row is selected, and the color for a selected
row is blue. when I delete a row, the nearest is selected

What I get now:
1. when I delete a row, no row is shown as selected
2. when I delete a row, the color for rows get into a messy

you can see 1 and 2 at
http://logistics4hell.googlepages.com/q2.gif
http://logistics4hell.googlepages.com/q3.gif

P.S. Well, that is the problem I have asked before, but it seems that
it is hard for you to have a look at the pic, so I re-upload it. I
have not idea about this problem, so I also need someone to shed
lights on it

oyster wrote:

thanks in advance. I have tried to kill the bugs for several days, but
I found nothing useful
I have been nagged not to sleep well those days :frowning:

http://logistics4hell.googlepages.com/pack.zip is the code

what I want looks like http://logistics4hell.googlepages.com/iwant.gif :
1. the row is displayed in white-grey-white-... color, so make it easy
to read, that should be true when I delete a row
2. there is always one row is selected, and the color for a selected
row is blue. when I delete a row, the nearest is selected

What I get now:
1. when I delete a row, no row is shown as selected
2. when I delete a row, the color for rows get into a messy

you can see 1 and 2 at
http://logistics4hell.googlepages.com/q2.gif
http://logistics4hell.googlepages.com/q3.gif

P.S. Well, that is the problem I have asked before, but it seems that
it is hard for you to have a look at the pic, so I re-upload it. I
have not idea about this problem, so I also need someone to shed
lights on it

Well, for selecting the first item after I delete, I do this:

self.list_ctrl.SetItemState(0, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)

This selects the first item in the list control. If you need it to select the one immediately after the row you deleted, you'll need to keep track of the row to select the right one.

I don't have alternating colors in my list control...only in my ObjectListView control, so I don't know how to answer that question.

路路路

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

oyster wrote:

thanks in advance. I have tried to kill the bugs for several days, but
I found nothing useful
I have been nagged not to sleep well those days :frowning:

http://logistics4hell.googlepages.com/pack.zip is the code

Including a 500K images module when you only use two small triangle bitmaps is a bit overkill, don't you think?

what I want looks like http://logistics4hell.googlepages.com/iwant.gif :
1. the row is displayed in white-grey-white-... color, so make it easy
to read, that should be true when I delete a row
2. there is always one row is selected, and the color for a selected
row is blue. when I delete a row, the nearest is selected

What I get now:
1. when I delete a row, no row is shown as selected

It is selected, at least in your screen shots. However the focus is in the delete button so the listctrl is not showing the selected item with the blue (focused) color, but with the grey (unfocused) color instead. You'll see the same effect if you Tab out of the listctrl when it has the focus.

2. when I delete a row, the color for rows get into a messy

In what way? Or is it ok if you take into account the fact that the unfocused selection color is not what you were expecting?

路路路

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!