First click only gains focus

I’ve noticed in wx apps that if the app doesn’t currently have focus, clicking onto the app will only gain focus and the click wont interact with anything inside of the app.

For example clicking on a button in an out of focus app will only gain focus, and a second click is then needed to click the button

This doesn’t seem to be the behaviour of any other application.

Is there a way to change the behaviour to have a click gain focus and click?

Paul wrote:

I've noticed in wx apps that if the app doesn't currently have focus,
clicking onto the app will only gain focus and the click wont interact
with anything inside of the app.

For example clicking on a button in an out of focus app will only gain
focus, and a second click is then needed to click the button

This doesn't seem to be the behaviour of any other application.

Is there a way to change the behaviour to have a click gain focus and
click?

What operating system are you running? I don't see this behavior with
the wx demo on Windows.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

If you are on OSX then that is normal behavior as defined in the HIG, and is one of my pet-peeves about about OSX. I don't like the inconsistency[1], especially on an OS that prides itself on being consistent even across 3rd party applications. Look closer at other application, I'm sure that you will see similar behavior with them, although it seems that more and more Apple applications (like iTunes and System Preferences) are breaking their own rule about left-clicks...

[1] Some things, like toolbar buttons or the caption bar gumdrops will activate on first click, other things don't. OTOH, right-clicking or other mouse events usually do activate on the first click, and mouse motion or wheel events are also sent to background application windows the same as if they were in the foreground.

···

On 8/14/12 9:31 AM, Paul wrote:

I've noticed in wx apps that if the app doesn't currently have focus,
clicking onto the app will only gain focus and the click wont interact
with anything inside of the app.

For example clicking on a button in an out of focus app will only gain
focus, and a second click is then needed to click the button

This doesn't seem to be the behaviour of any other application.

Is there a way to change the behaviour to have a click gain focus and click?

--
Robin Dunn
Software Craftsman

I’ve noticed in wx apps that if the app doesn’t currently have focus,

clicking onto the app will only gain focus and the click wont interact

with anything inside of the app.

For example clicking on a button in an out of focus app will only gain

focus, and a second click is then needed to click the button

This doesn’t seem to be the behaviour of any other application.

Is there a way to change the behaviour to have a click gain focus and click?

If you are on OSX then that is normal behavior as defined in the HIG, and is one of my pet-peeves about about OSX. I don’t like the inconsistency[1], especially on an OS that prides itself on being consistent even across 3rd party applications. Look closer at other application, I’m sure that you will see similar behavior with them, although it seems that more and more Apple applications (like iTunes and System Preferences) are breaking their own rule about left-clicks…

[1] Some things, like toolbar buttons or the caption bar gumdrops will activate on first click, other things don’t. OTOH, right-clicking or other mouse events usually do activate on the first click, and mouse motion or wheel events are also sent to background application windows the same as if they were in the foreground.

I am on OSX 10.7

Playing around a bit more there does seem to be a lot of inconstancy, Chrome will work on first click on the parts of chrome, tabs etc, even getting mouse over events, but nothing on the webpages works on first click. VLC works on first click with play, stop buttons etc but not with anything else. I’m running PyCharm and this will work with first clicks, as well as Adium, Terminal, Console, Mail and I think everything I have open at the moment. The wx app seems to be the one that doesn’t respond to any first clicks (wait I just realised the mac native tool bar responds to first clicks, interesting the mac part of the code breaking the rules :P).

Would be nice to be able to enable this. The reason I ask is that I’ve just been watching user tests of the wx application and I’ve seen a few people, who probably dont realise the app is out of focus, click on a button and sit waiting for the app to do something, bit it isn’t doing anything because the button was never clicked, even though it was clicked on.

···

On 14 August 2012 18:05, Robin Dunn robin@alldunn.com wrote:

On 8/14/12 9:31 AM, Paul wrote:

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

I would think that you could do something along the lines of:
OnAppGetFocus(evt):
if OS == (‘MaxOSX’): # Extremely pseudo code MouseState = GetMouseState()
if MouseState.IsMouseClick(): # Or something equivalent to
make sure that the evt2 = wx.Event(MouseEvent)
# Copy the mouse position into the new event
self.Window.RaiseEvent(evt2) # Now if the click was on a
control it should see the event
N.B. These are not the correct library calls but I am sure there are
equivalents.
Gadget/Steve

···

On 14/08/2012 7:05 PM, Paul Wiseman
wrote:

On 14 August 2012 18:05, Robin Dunn robin@alldunn.com
wrote:

On 8/14/12 9:31 AM, Paul wrote:

          I've noticed in wx apps that if the app doesn't currently

have focus,

          clicking onto the app will only gain focus and the click

wont interact

          with anything inside of the app.



          For example clicking on a button in an out of focus app

will only gain

          focus, and a second click is then needed to click the

button

          This doesn't seem to be the behaviour of any other

application.

          Is there a way to change the behaviour to have a click

gain focus and click?

      If you are on OSX then that is normal behavior as defined in

the HIG, and is one of my pet-peeves about about OSX. I don’t
like the inconsistency[1], especially on an OS that prides
itself on being consistent even across 3rd party applications.
Look closer at other application, I’m sure that you will see
similar behavior with them, although it seems that more and
more Apple applications (like iTunes and System Preferences)
are breaking their own rule about left-clicks…

      [1] Some things, like toolbar buttons or the caption bar

gumdrops will activate on first click, other things don’t.
OTOH, right-clicking or other mouse events usually do
activate on the first click, and mouse motion or wheel events
are also sent to background application windows the same as if
they were in the foreground.

I am on OSX 10.7

      Playing around a bit more there does seem to be a lot

of inconstancy, Chrome will work on first click on the parts
of chrome, tabs etc, even getting mouse over events, but
nothing on the webpages works on first click. VLC works on
first click with play, stop buttons etc but not with anything
else. I’m running PyCharm and this will work with first
clicks, as well as Adium, Terminal, Console, Mail and I think
everything I have open at the moment. The wx app seems to be
the one that doesn’t respond to any first clicks (wait I just
realised the mac
native tool bar
responds to first clicks, interesting
the mac part of the code breaking the rules :P).

      Would be nice to be able to enable this. The reason I ask

is that I’ve just been watching user tests of the wx
application and I’ve seen a few people, who probably dont
realise the app is out of focus, click on a button and sit
waiting for the app to do something, bit it isn’t doing
anything because the button was never clicked, even though it
was clicked on.

          --

          Robin Dunn

          Software Craftsman

          [http://wxPython.org](http://wxPython.org)




          --

          To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

          or visit [http://groups.google.com/group/wxPython-users?hl=en](http://groups.google.com/group/wxPython-users?hl=en)
  --

  To unsubscribe, send email to

or visit

wxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

Sending a new wx.Event that way will only deliver it to any wx event bindings for the window, it will not be turned in to a native event that could cause a normal native button click that would get turned into a EVT_BUTTON event, for example.

wx.UIActionSimulator could probably do it however, but IMO it's still just a band-aid fix that just hides the real issue... Perhaps a wx.SystemOption or something could be added that would turn on a first click pass-through mode, create a ticket about it at trac.wxwxidgets.org and see if Stefan has any ideas about it.

···

On 8/14/12 11:26 AM, Gadget/Steve wrote:

I would think that you could do something along the lines of:
OnAppGetFocus(evt):
     if OS == ('MaxOSX'): # Extremely pseudo code
        MouseState = GetMouseState()
        if MouseState.IsMouseClick(): # Or something equivalent to make
sure that the
           evt2 = wx.Event(MouseEvent)
           # Copy the mouse position into the new event
           self.Window.RaiseEvent(evt2) # Now if the click was on a
control it should see the event

N.B. These are not the correct library calls but I am sure there are
equivalents.

--
Robin Dunn
Software Craftsman