开发者

Windows App Focus: Why does it require a click?

When I have 2 apps open and one has the focus but I want to execute a command in the other app, it requires a click to regain focus and another to execute the command. Is there some go开发者_开发技巧od reason why I couldn't take focus on MouseOver? I'm working with a WPF app if that is pertinent. TIA

EDIT: Oddly enough the MouseOvers work without focus.


I would not recommend doing this. This is not a standard way of working in Windows, so you will confuse your users. People are used to clicking into an application (or tabbing) to provide focus.

However, this is a configurable setting via the Accessability Tools in Windows. It can be enabled by choosing "Activate a window by hovering over it with the mouse" globally. Let your users specify this behavior if they want it.


The setting is configurable at a system-wide level. You should never ever override the user's current setting regarding this.

MS Windows Vista -- focus follows mouse (There's also a link on how to do it on XP.)

Edit: Normally, you can click a button on a form and both bring focus to the window and click it at the same time. The origins of the current setting "eating" the initial mouse click that brings focus to a window started as a fix to a bug in the Ribbon UI. The discussion is somewhere in this video: The Story of the Ribbon. Sorry I can't narrow it down more than that, but at least the video is a great insight and work watching - maybe you can send a message to Jensen Harris if you need a faster answer.

Edit 2: I just added a button to a WPF window, and I'm able to click it as long as I can see it - whether or not the window has focus.


You can take focus on MouseOver manually

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜