Mouse question

Hi All,

Is it possible to know if the user resize a row of a grid, in the aim to block other function of the program ?

In this case, under Linux (Not MS-W), if a new panel is open, the mouse is blocked.

Thanks, in advance, for suggestions.

Cheers.

···

--

Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

Hi All,

Is it possible to know if the user resize a row of a grid, in the aim to
block other function of the program ?

I think you need to catch wx.EVT_GRID_ROW_SIZE for this...but I don't
see how resizing a row in a grid is related to the new panel mentioned
below:

In this case, under Linux (Not MS-W), if a new panel is open, the mouse
is blocked.

Thanks, in advance, for suggestions.

Cheers.

--

Hugues JEAN-BAPTISTE (h...@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

Good luck!

···

On Oct 12, 3:24 am, Hugues JEAN-BAPTISTE <h...@agorinfo.fr> wrote:

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Mike Driscoll a écrit :

Hi All,

Is it possible to know if the user resize a row of a grid, in the aim to
block other function of the program ?
    
I think you need to catch wx.EVT_GRID_ROW_SIZE for this...but I don't
see how resizing a row in a grid is related to the new panel mentioned
below:

In this case, under Linux (Not MS-W), if a new panel is open, the mouse
is blocked.

Thanks, in advance, for suggestions.

In my program, when an user use the <F3> key, a new panel is open to permit a selection.
My problem is the user click to resize a row and at the same time use the <F3> key.
At this moment the mouse is blocked and the only solution is to use the keyboard to close the new panel <Alt-F4>.
This problem appears only on Linux ...

···

On Oct 12, 3:24 am, Hugues JEAN-BAPTISTE <h...@agorinfo.fr> wrote:

--

Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

Mike Driscoll a écrit :

Hi All,

Is it possible to know if the user resize a row of a grid, in the aim to
block other function of the program ?
    
I think you need to catch wx.EVT_GRID_ROW_SIZE for this...but I don't
see how resizing a row in a grid is related to the new panel mentioned
below:

In this case, under Linux (Not MS-W), if a new panel is open, the mouse
is blocked.

Thanks, in advance, for suggestions.

Cheers.

--

Hugues JEAN-BAPTISTE (h...@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)
    
Good luck!

-------------------
Mike Driscoll
  

Is it possible to test something as :

if self.MouseLeftIsClickedDown() :
    goto end ... :wink:

···

On Oct 12, 3:24 am, Hugues JEAN-BAPTISTE <h...@agorinfo.fr> wrote:

--

Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

I think this would be written more like:

self.myWidget.Bind(wx.EVT_LEFT_DOWN, self.OnMyWidgetLeftDown)

def OnMyWidgetLeftDown(self, event):
    event.Skip()
    #replace or add to above line whatever action you want.

If you mean "is clicked down" to mean "while it is still clicked down"
you could do make something more complex with a binding to
EVT_LEFT_UP, too, so that some condition will hold until that
releasing-the-mouse-button event changes it.

···

On Mon, Oct 12, 2009 at 12:56 PM, Hugues JEAN-BAPTISTE <hjb@agorinfo.fr> wrote:

Mike Driscoll a écrit :

On Oct 12, 3:24 am, Hugues JEAN-BAPTISTE <h...@agorinfo.fr> wrote:

Hi All,

Is it possible to know if the user resize a row of a grid, in the aim to
block other function of the program ?

I think you need to catch wx.EVT_GRID_ROW_SIZE for this...but I don't
see how resizing a row in a grid is related to the new panel mentioned
below:

In this case, under Linux (Not MS-W), if a new panel is open, the mouse
is blocked.

Thanks, in advance, for suggestions.

Cheers.

--

Hugues JEAN-BAPTISTE (h...@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

Good luck!

-------------------
Mike Driscoll

Is it possible to test something as :

if self.MouseLeftIsClickedDown() :
goto end ... :wink:

The problem is that I think he wants to know if the mouse is being used for something anywhere in the program, not within the same widget, so doing something like the above could cause encapsulation/coupling issues, or simply miss some possibilities.

You can use wx.GetMouseState to find the state of the mouse buttons and modifiers "at this moment in time," which may or may not be the same state it was in when the F3 accelerator was pressed.

s = wx.GetMouseState()
if s.LeftDown():
     return

···

On 10/12/09 10:08 AM, C M wrote:

Is it possible to test something as :

if self.MouseLeftIsClickedDown() :
    goto end ... :wink:

I think this would be written more like:

self.myWidget.Bind(wx.EVT_LEFT_DOWN, self.OnMyWidgetLeftDown)

def OnMyWidgetLeftDown(self, event):
     event.Skip()
     #replace or add to above line whatever action you want.

If you mean "is clicked down" to mean "while it is still clicked down"
you could do make something more complex with a binding to
EVT_LEFT_UP, too, so that some condition will hold until that
releasing-the-mouse-button event changes it.

--
Robin Dunn
Software Craftsman

Robin Dunn a écrit :

···

On 10/12/09 10:08 AM, C M wrote:

Is it possible to test something as :

if self.MouseLeftIsClickedDown() :
    goto end ... :wink:
      

I think this would be written more like:

self.myWidget.Bind(wx.EVT_LEFT_DOWN, self.OnMyWidgetLeftDown)

def OnMyWidgetLeftDown(self, event):
     event.Skip()
     #replace or add to above line whatever action you want.

If you mean "is clicked down" to mean "while it is still clicked down"
you could do make something more complex with a binding to
EVT_LEFT_UP, too, so that some condition will hold until that
releasing-the-mouse-button event changes it.
    
The problem is that I think he wants to know if the mouse is being used for something anywhere in the program, not within the same widget, so doing something like the above could cause encapsulation/coupling issues, or simply miss some possibilities.

You can use wx.GetMouseState to find the state of the mouse buttons and modifiers "at this moment in time," which may or may not be the same state it was in when the F3 accelerator was pressed.

s = wx.GetMouseState()
if s.LeftDown():
     return
  

Thanks to "C M" and Robin for the answers.

wx.GetMouseState() works perfectly for my problem.

I am just surprised because I didn't find this function in the documentation !...
Is there many others functions so efficient, not documented ?

--

Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)