Hello,
So I'm in the following situation, on MacOS 10.7.2, wx version 2.8.12.0:
I have a ultimatelistctrl
class UltimateListCtrl(ULC.UltimateListCtrl,
listmix.ListCtrlAutoWidthMixin, listmix.ListRowHighlighter):
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0, agwStyle=ULC.ULC_NO_HIGHLIGHT):
ULC.UltimateListCtrl.__init__(self, parent, id, pos, size, style, agwStyle)
listmix.ListCtrlAutoWidthMixin.__init__(self)
self.setResizeColumn("LAST")This has some wx.lib.agw.hyperlink items added like:
data_structured_item = self.list.GetItem(index, 4)
hyper_link = hl.HyperLinkCtrl(self.list, wx.ID_ANY, text)
hyper_link.AutoBrowse(False)
hyper_link.SetBackgroundColour("white")
hyper_link.SetColours("#808080", "#808080", "BLUE")
hyper_link.EnableRollover(True)
hyper_link.SetUnderlines(False, False, False)
hyper_link.SetBold(True)
hyper_link.UpdateLink()
hyper_link.Bind(hl.EVT_HYPERLINK_LEFT, self.on_data_structured)
data_structured_item.SetWindow(hyper_link, True)
self.list.SetItem(data_structured_item)But somehow, anytime some hyper_links are added/modified they all go
blank, until I do a mouse over event on one of them. Now I'm guessing
I'm missing some Layout() or Update() call somewhere but the situation
dazzles me. So:If I do a mouse over on any of the hyperlinks they repaint fine. If I
click somewhere outside my frame, I'm guessing a wx.FocusEvent generated
also gets them to repaint fine. If I resize my frame, they also repaint
just fine. Now I tried something like sugested here:
WhenAndHowToCallLayout - wxPyWiki and tried with Layout()
Refresh() or Update(), none worked.Finally I went the 'brute' way and:
while widget.GetParent():
widget = widget.GetParent()
if widget.IsTopLevel():
size = widget.GetSize()
widget.SetSize((size[0]+1, size[1]+1))
widget.SetSize(size)This works fine, so I thought, oh cool seems like I have to generate a
resize event on the top level frame, but:while widget.GetParent():
widget = widget.GetParent()
if widget.IsTopLevel():
widget.SendSizeEvent()This doesnt work either.
So my questions would be:
1. What is the difference between:widget.SetSize((size[0]+1, size[1]+1))
widget.SetSize(size)
and:
widget.SendSizeEvent()
It depends on the type of widget and what it does in it's default EVT_SIZE handler. Obviously there will be 2 size events in the first case and only one in the second, but also there will be newly exposed pixels in the first case so that will also trigger a EVT_PAINT event.
2. Is there some more proper way to handle the problem, like I'm missing
a call to something like Repaint() or Update() somewhere along there.
It seems you've already tried Refresh, which is what I would have suggested, so please make a runnable, small as possible, sample application that demonstrates the problem so we can take a closer look at what exactly you are doing or not doing. MakingSampleApps - wxPyWiki
···
On 11/25/11 2:06 AM, Neacsa Bogdan Valentin wrote:
--
Robin Dunn
Software Craftsman