Sending key down events to TextBox
Posted: 04 Apr 2020, 01:11
I am trying to send KeyDown/KeyUp Events to a TextBox when a User clicks a button from a separate NoesisView, something close to a virtual keyboard.
I have been using Unity and C#
I did a bunch of tests on the same NoesisView to see if that was the issue, but still no luck.
I have tried creating a new KeyEventArg and raising that event on the TextBox instance.
I have tried calling KeyDown on the TextBox View
The following works but I need to be able to send control keys to the TextBox
Is there a different way I should be doing this? or am I missing something.
I know I can use the Win32 API to send key events that way but I would like to use the framework if I can.
I have been using Unity and C#
I did a bunch of tests on the same NoesisView to see if that was the issue, but still no luck.
I have tried creating a new KeyEventArg and raising that event on the TextBox instance.
Code: Select all
((Button)FindName("TestButton")).Click += (sender, eventArgs) =>
{
var textBox = ((TextBox)FindName("TestInput"));
var kea = new KeyEventArgs(textBox, Noesis.Keyboard.KeyDownEvent, Key.A, KeyStates.Down | KeyStates.Toggled);
textBox.Focus();
textBox.RaiseEvent(kea);
};
Code: Select all
var textBox = ((TextBox)FindName("TestInput"));
textBox.Focus();
textBox.View.KeyDown(Key.A);
Code: Select all
((Button)FindName("TestButton")).Click += (sender, eventArgs) =>
{
var textBox = ((TextBox)FindName("TestInput"));
textBox.Focus();
textBox.View.Char('c');
};
I know I can use the Win32 API to send key events that way but I would like to use the framework if I can.