[wxPython-users] Re: bind popup menu to entries of HTMLListBox

Robin Dunn robin at alldunn.com
Mon Jun 19 14:45:28 PDT 2006


Kees wrote:
> Robin Dunn <robin <at> alldunn.com> writes:
> 
>> Kees wrote:
>>> ....
>> One of the base classes of wx.HtmlListBox has a HitTest(point) method 
>> that looks like is should do the job.  Have you tried that?
>>
>> 	item = self.HitTest(event.GetPosition())
> 
> Ok, I'm sorry but I don't seem to understand. Let me quickly describe what I
> have: in a wx.Frame instance, an instance "hlb" of a HTMLListBox:
> 
> self.hlb = KHTMLListBox(self.panel,<...>)
> self.hlb.Bind(wx.EVT_CONTEXT_MENU, self.onCallPopup1)
> 
> with the handler:
> 
> def onCallPopup1(self, event):
>    pos = self.panel.ScreenToClient(event.GetPosition())
>    print self.HitTest(event.GetPosition())
>    print self.HitTest(pos)

You should be calling self.hlb's HitTest method, not self's.  Also, does 
the value of event.GetPosition  make sense?  There was a time when the 
EVT_CONTEXT_MENU event didn't send it, but that may have changed.

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





More information about the wxpython-users mailing list