Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Prevent Window Focus Change
Message
From
05/05/2009 03:26:22
 
 
To
04/05/2009 22:20:10
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01397901
Message ID:
01397918
Views:
39
>I'm trying to help a disabled person with a small bit of code to help him play a game easier. He is limited to a trackball and a single button.
>
>Currently he uses the onscreen keyboard and has managed to play other games using it. I've created a small bit of code to try and make his live easier. It uses hover buttons for the keys. When the mouse pointer enters the button it sends key down, when it moves off the button it sends key up.
>
>I have that working and I think (or hope) he's going to like it. It worked pretty well when I tested it.
>
>I want to add one more piece of functionality to it. If he clicks while over my control, I want to send a different key stroke. Not a problem, I can do that. However, when I do that window focus shifts from the game to my control.
>
>I found this on MSDN:
>
>http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/48737c2b-7e6f-4ade-ac1c-7dd2f5cc2b88/
>
>That works to prevent my window from activating, but it still causes the game to loose focus. I can set the focus back to the game, but I would prefer if it just never lost focus.
>
>Anyone have any ideas on how you might do that?

I wonder whether, instead of a button, it might be better to use a control from higher up the inheritance chain that doesn't implement the default click behaviour? Haven't got WPF in front of me but maybe ContentControl is far enough? Just a thought,
Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform