mouse events

From: Nigel Moriarty [mailto:a_list@attbi.com]
Sent: Monday, March 10, 2003 1:12 PM
To: wxPython-users
Subject: [wxPython-users] mouse events

Folks

I want to be able to determine if the user has clicked in my
GUI outside a
specific wxScollWindow. I know that there is a mouse leave
event but I
need to check for the click (any click).

Is this possible with wxPython commands or will I have to log
mouse events
into some global variable (and how?)

Nigel

I needed to do something similar. I had a panel with some controls on it.
Once the cursor "entered" the panel, I wanted a "hand" cursor. I did it
with the class below. I assume you could do something similar with
wxScrollWindow. Maybe set a global variable in OnEnterWindow:

def OnEnterWindow( self, event ):
  in_scroll_wnd = 1

def OnLeaveWindow( self, event ):
  in_scroll_wnd = 0

Then, later check in_scroll_wnd when you process click events.

class MouseoverPanel( wxPanel ):
    def __init__( self, parent, id, pos = wxPyDefaultPosition,
                  size = wxPyDefaultSize, style = 0, name="rolloverPanel" ):
        wxPanel.__init__( self, parent, id, pos, size, style, name )
        self.SetBackgroundColour( parent.GetBackgroundColour() )
        EVT_ENTER_WINDOW( self, self.OnEnterWindow )
        EVT_LEAVE_WINDOW( self, self.OnLeaveWindow )
        
    def OnEnterWindow( self, event ):
        self.SetCursor( wxStockCursor( wxCURSOR_HAND ) )

    def OnLeaveWindow( self, event ):
        self.SetCursor( wxNullCursor )

HTH,
jaime

ยทยทยท

-----Original Message-----
        
--
Nigel W. Moriarty
Building 4R0230
Physical Biosciences Division
Lawrence Berkeley National Laboratory
Berkeley, CA 94720-8235
Phone : 510-486-5709
Fax : 510-486-5909
Email : NWMoriarty@LBL.gov
Web : CCI.LBL.gov

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwindows.org