1

I made a virtual keyboard in xaml c# using WPF. Its totally working and great. However I would like to add a few quality of life things if possible. Is there a method of having it take keyboard input while in the background and your primary application is say notepad. The virtual keyboard highlights keys as they are pressed is why this is important.

Barring this is there a way to make the text in a textblock selectable for copy paste (I can track what was typed and post it in one, BUT THE TEXT SHOULD NOT BE DIRECTLY ALTERABLE!!!!, much like a website)

I'd also like to know if there is a way to have the curser default to a textbox rather than having to click it.

babno
  • 13
  • 2
  • by "take keyboard input" do you mean literally response to physical keyboard key presses while the virtual keyboard app doesn't have focus, or that the window will receive mouse clicks (or pen gestures) while it doesn't have focus? – RQDQ Mar 03 '11 at 20:04
  • the physical keyboard presses. Its an alternative keyboard with a different layout, so it needs to show you which key you pressed. There is no clicking involved. – babno Mar 03 '11 at 20:14

2 Answers2

0

You should use low level hooks in your app for show pressed keys.

See a code sample here.

Community
  • 1
  • 1
acoolaum
  • 2,132
  • 2
  • 15
  • 24
0

I can't help with the keyboard part, but there are a couple of ways to do the copy only text:

Barring this is there a way to make the text in a textblock selectable for copy paste (I can track what was typed and post it in one, BUT THE TEXT SHOULD NOT BE DIRECTLY ALTERABLE!!!!, much like a website)

For one, you could just create a TextBox that is marked with IsReadOnly=true. You could also display a FlowDocument with a textblock on the inside.

As for defaulting (I'm assuming you mean focus), this might help:

http://msdn.microsoft.com/en-us/library/aa969768.aspx

RQDQ
  • 15,461
  • 2
  • 32
  • 59