[wxPython-users] LB_MULTIPLE on wxVListBox

Robin Dunn robin at alldunn.com
Sat Sep 1 18:01:03 PDT 2007


Diego Jacobi wrote:
> Cool!
> Thanks Robin. :-D
> 
> I didnt know about the abilities of wxMouseEvents. Now i know.
> 
> But there is one still missing thing, and it is that, in the frame where 
> i use MyVListBox y have binded the event wx.EVT_LISTBOX , and with it i 
> do some task in another VListBox but when i deselect the last selected 
> item (so no items keep selected) no event is fired (a bug?).

I don't know, maybe.  Enter a bug report about it.

> 
> How can i force it to fire wx.EVT_LISTBOX?

You'll probably have to special case it somehow.

> 
> 
> Also, on the other hand, i have maked a switch-color feature between 
> rows, and to use the system defined colors i choose to use the same 
> color as the scrollbar.
> 
>     def OnDrawBackground(self, dc, rect, n):
>         #Draw the background and maybe a border if desired.
>         if self.IsSelected(n):
>             bg = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT )
>         else:
>             if n % 2:
>                 bg = wx.SystemSettings.GetColour(wx.SYS_COLOUR_SCROLLBAR)
>             else:
>                 bg = self.GetBackgroundColour()
>         dc.SetBrush(wx.Brush (bg, wx.SOLID))
>         dc.DrawRectangle(rect[0],rect[1],rect[2],rect[3])
> 
> I couldn't find a system color for that use. Is there any? 

No, I don't think so.


> Should i keep 
> using scrollbars color?

If it works for you then I'd keep doing it that way.  Another way would 
be to calculate the color based on the system selection color, such as a 
lighter version of the same color, or the same color tinted with grey.


> It is very goodlooking to have 2 colors for use alternatively in each row.
> 
> 
> PD:
> In my opinion VListBox is a great ctrl. There could be a better example 
> in the demo showing some magics with it. Like showing icons per item, 
> showing some other ctrl when selected and maybe an expand effect.
> Also it seems a little forgeted. As there are common methods in 
> ListBoxes not present in VListBox, like toggle.

If you like you can enhance the demo and send me a patch.


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





More information about the wxpython-users mailing list