Hi,
When using the Select method with ultimatelistctrl (wx.LC_REPORT
style), it doesn't use the colors specified in SetFirstGradientColour
and SetSecondGradientColour. I believe that's because it has different
state flags right?
If that is right, then I believe I need to use the SetItemState method
but I'm not sure what to put as the stateMask. Would I just write out
ULC_STATE_SELECTED for both state and stateMask?
If not, then what do I need to do when using Select to have it obey my
chosen gradient colour?
Thanks,
Adam
HI,
Hi,
When using the Select method with ultimatelistctrl (wx.LC_REPORT
style), it doesn't use the colors specified in SetFirstGradientColour
and SetSecondGradientColour. I believe that's because it has different
state flags right?
If that is right, then I believe I need to use the SetItemState method
but I'm not sure what to put as the stateMask. Would I just write out
ULC_STATE_SELECTED for both state and stateMask?
If not, then what do I need to do when using Select to have it obey my
chosen gradient colour?
Have you called "EnableSelectionGradient()" before actually selecting
your item (and optionally "SetGradientStyle" for vertical/horizontal
gradients)? It seems to work for me in the demo if I do either one of
these things:
list.SetItemState(5, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
OR:
list.Select(5, True)
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On 9 April 2012 05:42, blissend wrote:
I’ve attached a sample app demostrating the problem. I’m using Win 7 (64bit), Python 2.7.2, wxpython 2.9.3.1
In my code, it’s a weird way to demonstrate I know, but clicking the button to force a selection doesn’t select with my colors. You can see the colors properly apply if you manually select something. Let me know if nobody see’s what I mean.
Also, in the wxpython demo you can sort of see the same thing if you keep alternating between the themes.
debug.py (1.68 KB)
···
On Monday, April 9, 2012 7:22:12 AM UTC-4, Infinity77 wrote:
HI,
On 9 April 2012 05:42, blissend wrote:
Hi,
When using the Select method with ultimatelistctrl (wx.LC_REPORT
style), it doesn’t use the colors specified in SetFirstGradientColour
and SetSecondGradientColour. I believe that’s because it has different
state flags right?
If that is right, then I believe I need to use the SetItemState method
but I’m not sure what to put as the stateMask. Would I just write out
ULC_STATE_SELECTED for both state and stateMask?
If not, then what do I need to do when using Select to have it obey my
chosen gradient colour?
Have you called “EnableSelectionGradient()” before actually selecting
your item (and optionally “SetGradientStyle” for vertical/horizontal
gradients)? It seems to work for me in the demo if I do either one of
these things:
list.SetItemState(5, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
OR:
list.Select(5, True)
Andrea.
“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/
Hi,
I've attached a sample app demostrating the problem. I'm using Win 7
(64bit), Python 2.7.2, wxpython 2.9.3.1
In my code, it's a weird way to demonstrate I know, but clicking the button
to force a selection doesn't select with my colors. You can see the colors
properly apply if you manually select something. Let me know if nobody see's
what I mean.
Also, in the wxpython demo you can sort of see the same thing if you keep
alternating between the themes.
1) Please do not top-post: DoNotTopPost - wxPyWiki
2) Your problem derives from the fact that when you click the button,
you list control has no focus (because the focus is on the button
itself), so ULC will use whatever default colours are defined for
unfocused-gradient selections. You will get the same behaviour out of
a standard wx.ListCtrl, by the way.
There are 2 solutions to this:
a) Call self.list_ctrl.SetFocus() right after you click the button;
b) Change the self._highlightUnfocusedBrush and self._highlightBrush
colours in the ULC source code to always return the brush colours you
want (not recommended).
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
···
On 9 April 2012 18:10, blissend wrote:
Sorry for the top post, googlegroups web does it by default apparently unless I defined it somewhere. Anyway, SetFocus did the trick! Thanks!