I'm converting a reaction time test to tablet PC. The test involves the user pressing the 5 key on the numeric keypad and holding it down until a random timer fires off and gives them a direction stimulus. They are then supposed to release the key and press the corresponding direction key (8, 4, 6, 2) and then return to pressing and holding the 5 key.
The problem I'm having is that the tablet treats a long press or press and hold as a right click. I need to be able to override this behavior. If I put a button on the form with a mousedown and mouseup event, the mousedown event fires properly if I tap-taphold, and then mouseup fires when I release. but I need a similar event to mousedown for a long press that isn't preparing the tablet for right click.
Any ideas?
Assuming you are using WinRT-XAML and not WPF, Silverlight or Windows Forms - you could use the PointerPressed/PointerReleased events instead of the click or gesture events.
Related
Is it possible to remove the limit for the Mouse Click speed in C#?
Im trying to make a Click Game Programm. You have 15 seconds time to click on a Panel as fast as you can. Every click is a Point.
The Problem is... As example, when i click 10 times per second, I only get 5-6 Points per seconds and so I can't click as fast as I can.
Has somebody an idea to bypass this?
Thanks
When you subscribe to the Click event, you will not see second clicks that occur in the doubleclick treshold, those are propagated to the DoubleClick event handler.
If you want to register clicks and bypass double click detection, subscribe to the MouseDown event instead.
I'm experiencing a strange bug(?) with my uwp app.
I have a page with multiple textboxes for user input that each have the InputScope set to number, which then opens the keyboard in tablet mode as expected. However if you tap on the next box the keyboard closes and a second tap is needed to open the keyboard. This also happens if the user hits tab to switch boxes.
I presume this has something to do with the Focus() event firing before the previous textbox has fired the loss of focus event but im unsure how to override the behavior.
How can i prevent the onscreen keyboard from closing, but also make sure the correct inputscope is still maintained?
Edit: Upon further investigation, the issue seems to be almost random. Sometimes you can move to different boxes and it remains open but other times it closes the keyboard every time.
This issue has been resolved with some others, in Windows 10 version 1803 released on 30th April, 2018.
You can try to play with InputPane that is a container for on-screen keyboard. For example, doing a small delay once the pane is trying to hide, then detect attempts to show the pane again (and cancel pending hide).
myPane = InputPane.GetForCurrentView();
myPane.Showing += myShowingHandler();
myPane.Hiding += myHidingHandler();
At least, you can receive a size of underlying screen region on the pane showing so you can put a placeholder (margin or dummy grid) on your UI to prevent it jumping up and down on keyboard show/hide.
I tried your case on my WP but I cannot reproduce your experience:
When I tap to other TextBox, keyboard stays opened and I can continue typing.
Keyboard hides as expected when I tap somewhere to whitespace.
Don't you have keyboard connected to your device?
I would like to use a second mouse in my C# WPF application independently from my primary mouse.
So the primary mouse controls the cursor and the mouse buttons triggers the usual click, drag, mouse wheel, etc. events
From the second mouse I would like to receive the mouse move and click events but this one should not move the mouse cursor and should not be handled by the application itself e.g. fire a button command.
In the end I will send the mouse move X/Y delta and mouse click to another device to handle them.
So something like this
private void Window_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
var delta = oldPosition - e.MouseDevice.GetPosition(this);
DoSomething(delta);
e.Handled = true;
}
I found some links to Microsoft Multipoint SDK but this seems to be inactive since 2013 and I couldn't find any good examples.
On the other hand I found some applications using Raw Input to identify the keyboard / mouse device but I couldn't figure out how to listen to the events from the second mouse without influencing the mouse cursor and application.
Does anybody has a good idea or staring point?
Ok I tried a lot of different solution but I didn't get happy with one of them.
In the end I found this nice solution
Interception
that fits my needs. You need to install a software component and this one seems to hack in the system somewhere in between the mouse + keyboard and the OS kernel. From now on you can listen to the mouse/keyboard events from your software and modify them.
I am trying to make buttons seem like pressed automatically so the user can then follow the buttons pressed but everytime I try it doesn't seem natural because the computer does it really fast all the changes!
Any ideas? I have to get a serious of buttons pressed that look like user pressed and then pass to unpressed again
Thanks a lot!!!!
Well I'm trying to make a game where you remember the buttons that were randomly selected by the computer and then you press them, so I need computer to act like if the user were touching them and then the user follows...
How about using a custom storyboard animation that takes the button to the pressed, and then unpressed state?
I am working on a map editor for my game and I use the arrow keys to scroll around the map area. Currently I'm using the KeyDown event, which works fine for scrolling up, down, left or right - but my question would be how to allow diagonal scrolling. Currently, if I hold the right-arrow and then (whilst keeping the right-arrow held) I then press and hold the down-arrow, the down direction replaces the scrolling to the right instead of scrolling diagonally to the bottom right.
Is there a way, for instance, that I could check whether another arrow key is being pressed whilst in the KeyDown event? How can I respond to more than one key being held?
Thanks
Not easily, the key-down of the 2nd keystroke stops the 1st one from repeating. What you have to do is record that the key is down in the KeyDown event. Cancel that state in the KeyUp event. Next, use a Timer (~250 msec) and in its Tick event check the state of the keys.
The easiest way to do this is to use a Windows API call to get the state of every key on they keyboard, and then check the keys you are interested in: GetKeyboardState via PInvoke.
You can call it on KeyDown/KeyUp, check the state of the keyboard, and act appropriately.