AUIToolbar HitTest?

agw AuiToolBar has no HitTest method. Its OnLeftDown method is quite
difficult. Is there any easy way to tell what tool is under a given
position? It would be the best to have an AuiToolBar.HitTest method.

Thanks

   Laszlo

Hi,

agw AuiToolBar has no HitTest method. Its OnLeftDown method is quite

difficult. Is there any easy way to tell what tool is under a given

position? It would be the best to have an AuiToolBar.HitTest method.

Any patch solving this issue would be more than welcome.

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”

http://xoomer.alice.it/infinity77/

import PyQt4.QtGui

Traceback (most recent call last):

File “”, line 1, in

ImportError: No module named PyQt4.QtGui

import pygtk

Traceback (most recent call last):

File “”, line 1, in

ImportError: No module named pygtk

···

On 18 September 2011 19:48, nagylzs wrote:

import wx

> position? It would be the best to have an AuiToolBar.HitTest method.

Any patch solving this issue would be more than welcome.

I started to work on the batch. Starting with the OnLeftDown event
handler, went over this method:

FindToolForPosition(x,y)

So the "Patch" is to add this method to aui/auibar.py , class
AuiToolBar :

    def HitTest(self, x, y):
        """
        Finds a tool for the given mouse position.

        :param `x`: mouse `x` position;
        :param `y`: mouse `y` position.

        :returns: a pointer to a L{AuiToolBarItem} if a tool is found,
or ``None`` otherwise.

        Similar to FindToolForPosition but it works with absolute
coordinates.
        """
        return self.FindToolForPosition(*self.ScreenToClient((x,y)))

It is true that many wx widgets have this HitTest method. This is the
common name for this, and most users will search for it under this
name. Do you think it would be a good idea? Please let me know if you
want this and then I'll add a new patch request to Trac.

   Laszlo

Hi,

position? It would be the best to have an AuiToolBar.HitTest method.

Any patch solving this issue would be more than welcome.

I started to work on the batch. Starting with the OnLeftDown event

handler, went over this method:

FindToolForPosition(x,y)

So the “Patch” is to add this method to aui/auibar.py , class

AuiToolBar :

def HitTest(self, x, y):

    """

    Finds a tool for the given mouse position.



    :param `x`: mouse `x` position;

    :param `y`: mouse `y` position.



    :returns: a pointer to a L{AuiToolBarItem} if a tool is found,

or None otherwise.

    Similar to FindToolForPosition but it works with absolute

coordinates.

    """

    return self.FindToolForPosition(*self.ScreenToClient((x,y)))

It is true that many wx widgets have this HitTest method. This is the

common name for this, and most users will search for it under this

name. Do you think it would be a good idea? Please let me know if you

want this and then I’ll add a new patch request to Trac.

Yes, please do. Although I believe originally the HitTest method was not included because wx.ToolBar has no HitTest method, I still think this is a good idea.

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/

import PyQt4.QtGui

Traceback (most recent call last):

File “”, line 1, in

ImportError: No module named PyQt4.QtGui

import pygtk

Traceback (most recent call last):

File “”, line 1, in

ImportError: No module named pygtk

···

On 18 September 2011 22:25, nagylzs wrote:

import wx