Show up the On Screen keyboard if the user sets the focus on a textfield. WPF with .Net 4 Client profile
Asked Answered
L

1

6

For my full screen WPF application, I need to show up the Windows 7 onscreen keyboard, if a user sets the focus on a textfield.

There's no hard keyboard for the panel, just a mouse device to interact with it. In this case I need a onscreen keyboard to fill up the textfields.

The WPF-application is written in C# .Net on the .Net Framework 4.0 Client profile.

Thanks for reply Andi

Lintel answered 14/4, 2011 at 21:21 Comment(0)
A
5

You can wire up following code to TextBox's GotKeyboardFocus or GotFocus event

Process.Start("systempath..\\osk.exe");
Ask answered 17/4, 2011 at 18:23 Comment(7)
or more simply Process.Start("osk");Sachasachem
@SpeziFish, yes it will work but I am skeptical about resolution of path so I always prefer full path.Ask
@Akash, yes, but I'm not sure if it is always so easy to get the fullpath or if the fullpath is always the same on different os. Maybe with the next patch microsoft moves the file somewhere else :-)Sachasachem
There is a method called Environment.GetSpecialFolder that will return full path.Ask
by the way: you're "skeptical about resolution of path" but want to use special folder. I think it's almost the same problem with it, both are dependent to os, user and location. (We're are very offtopic meanwhile :-) )Sachasachem
msdn.microsoft.com/en-us/library/…Ask
You're on the right track: "Special folders are set by default by the system, or explicitly by the user, when installing a version of Windows. [...] The locations of these folders can have different values on different operating systems, the user can change some of the locations, and the locations are localized." So you can count on the specialfolder no more than on the path variable.Sachasachem

© 2022 - 2024 — McMap. All rights reserved.