Can I implement a mouseover event for wx.listbox? I’d like to show a tooltip message when user points mouse to an item in listbox. The document in this page
http://www.wxpython.org/onlinedocs.php only lists these two events: wxEVT_COMMAND_LISTBOX_SELECTED and wxEVT_COMMAND_LISTBOX_DOUBLECLICKED.
If the answer is no, how about treectrl or any other way?
Can I implement a mouseover event for wx.listbox? I'd like to show a tooltip message when user points mouse to an item in listbox. The document in this page http://www.wxpython.org/onlinedocs.php only lists these two events: wxEVT_COMMAND_LISTBOX_SELECTED and wxEVT_COMMAND_LISTBOX_DOUBLECLICKED.
If the answer is no, how about treectrl or any other way?
EVT_MOTION is available for any widget, but the problem here is that there isn't a HitTest method that will let you know which item the mouse is over. Instead you can use a wx.ListCtrl in report mode with a single column, but with the headers turned off. That will look and behave almost like the wx.ListBox but will let you detect with HitTest which item the mouse is over.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Is this something on the TODO list ? It'd be really handy
for making the tooltip display the entire row when the data
in the listctrl is partially obscured due to column width
listctrl size.
IIRC some platforms do that in the native control, no ?
Karsten
···
On Thu, Dec 28, 2006 at 10:54:06AM -0800, Robin Dunn wrote:
EVT_MOTION is available for any widget, but the problem here is that
there isn't a HitTest method that will let you know which item the mouse
is over.
EVT_MOTION is available for any widget, but the problem here is that there isn't a HitTest method that will let you know which item the mouse is over.
Is this something on the TODO list ? It'd be really handy
for making the tooltip display the entire row when the data
in the listctrl is partially obscured due to column width
listctrl size.
IIRC some platforms do that in the native control, no ?
On Win you can do this (I think Will Sadkin came up with this):
if "__WXMSW__" in wx.Platform:
# We are on Window$
# Turn on labeltips in list control
from win32api import SendMessage
import commctrl # from win32 extensions for constants
class ListCtrl(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
def __init__(self, parent, id, validator, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0):
wx.ListCtrl.__init__(self, parent, id, pos, size, style, validator)
listmix.ListCtrlAutoWidthMixin.__init__(self)
if "__WXMSW__" in wx.Platform:
# We are on Window$
# ENABLE label tip on listctrl
# All of the extended label styles are missing from the # current version (1.1) of commctrl.py, but this is the value # needed:
LVS_EX_LABELTIP = 16384
style = SendMessage(self.GetHandle(), commctrl.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
style = style | LVS_EX_LABELTIP
SendMessage(self.GetHandle(), commctrl.LVM_SETEXTENDEDLISTVIEWSTYLE, 0, style)
Werner
···
On Thu, Dec 28, 2006 at 10:54:06AM -0800, Robin Dunn wrote:
Karsten
On Thu, Dec 28, 2006 at 10:54:06AM -0800, Robin Dunn wrote:
EVT_MOTION is available for any widget, but the problem here is that there isn't a HitTest method that will let you know which item the mouse is over.
Is this something on the TODO list ? It'd be really handy
for making the tooltip display the entire row when the data
in the listctrl is partially obscured due to column width
listctrl size.
The original post was about wx.ListBox. wx.ListCtrl already has a HitTest method that lets you figure out which item or subitem that a mouse position corresponds to.
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!