I am making one "keyboard operated application" in which the user will use only keyboard.
The user will use left and right arrow keys, sometimes Up and Down arrow keys to navigate through different controls while filling a form.For that I use the keydown event and use SendKeys.SendWait({TAB}) for right key and SendKeys.SendWait(+{TAB}) for left key.
I have one DateTimePicker with custome format of dd/MM/yyyy.
When the year part is selected and the user presses the left arrow key, the focus moves to month part. when the arrow key is again pressed the focus moves to day part.
What I want is that when the day part is selected and the user presses the left arrow key, focus should move to the previous control (SendKeys.SendWait(+{TAB})).
Please suggest a solution.
Edit: The standard DateTimePicker does not expose any way to tell what element is selected, unfortunately, so it isn't possible to achieve this without creating your own control.
Related
I have multiple textbox when I press the tab key the cursor move to next textbox, but the my problem is that movement is not sequential or in other owrd is random movement lets say textbox1 textbox2 textbox3 textbox4 the movement is 2,3,1,4 so look how to get the movement back to its correct order
since The control move over to the other on entering TAB according to sequence in which they are drag drooped(or created).
I tried to organize the code in designer but that's does not effect the movement
then how to order the cursor movement ?
is theira code in somewhere to modify according to the order i want ?
Here's a good step-by-step tutorial on MSDN:
How to: Set the Tab Order on Windows Forms
I am developing a Custom Editable Text Block for my Application. So when the User clicks on the Control, TextBox swaps in for the User to edit the Text. Everything is fine till now, Now my requirement is I want the caret index of TextBox to exactly where the user had clicked on the TextBlock.
So the user won't feel about the swap from UI Point of View.
What approach would be more appropriate? Considering the above factors?!
I am lost in ideas for this thing.
I assume you have a UserControl/Customcontrol with its own Mouse handling support, and a way to tell when to switch the content from TextBlock to TextBox.
In the mousedown event you could store the clicked position, swap to the textbox and in the Loaded event you could use GetCharacterIndexFromPoint to tell which is the position of the click and set the CaretIndex to that position. You might have to adjust your margins if you use any.
Is there anyway to make it look like a TextBox has focus when it really does not? I would like to display the flashing cursor in a WPF TextBox even though it does not have focus.
Why do I want to do this?
We have a system that accepts touch input from more than one user at a time. One of the users has focus and I cant have it jumping between controls. The secondn user input is from an on-screen keyboard. As they type the letters the text is entered in the textbox. It just looks strange for there not to be a cursor.
Well I think You can use animations for your TextBoxs, it will play all the time or at any time you want without being focused, hope it will help.
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.