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.
Related
Im devoloping a UWP app and I came across a problem.
In my input page when I tap a textbox the keyboard just "pushes" the UI upwards and this happens.
Normal screen:
Check at the top of the page, you can see the problem:
Does anyone know a fix for this? Thanks!
I think this is default behaviour of the keyboard and can't be changed.
If the keyboard would not push the content upwards, it would overlap the actual TextBox, which you want to fill with text.
If your problem is the statusbar getting overlapped/underlapped with the page-content, you could try to change the color of the statusbar, it seems to be transparent at the moment.
See this.
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.
I am using a WFA which has a ToolStripMenuItem that is supposed to search for a word in a textBox and highlight it. This is the highlighting code.
first = first index to be highlighted
, length= number of characters to be highlighted.
textBox2.SelectionStart = first;
textBox2.SelectionLength = length;
//scroll to the caret
textBox2.ScrollToCaret();
everything seems to be working well. However, If the mouse cursor isn't inside textBox2 (say in another textBox). The highlighting doesn't work. Is there a way to make it work regardless of the position of the mouse cursor? in other words, is there a way to change my code to make it highlight the text in textBox2 even if the mouse cursor wasn't inside textBox2 before hitting the ToolStripMenuItem?
P.S. It's worth mentioning that I am using c# in VS 2010
Try:
textBox2.Focus();
before you run the code that highlights the text. This will move input focus (and your cursor) to the textbox
just use richtextbox and change the backcolor of the text.
this way you can use multiple highlights at a time and the highlight won't be lost after the user focus the textbox by mouseclick. Additionally you can save all postions and automatically select the textpart if the user clicks into the highlighted area.
you can also show the selection like LarsTech mentioned, but after the user clicks inside the textbox the selection will get lost.
I've created a canvas like control that draws images, shapes and text. Right now text can be added to the drawing surface only programmatically. But I would like to implement a more WYSIWYG-like text input method. So the basic idea is to capture keystrokes inside my ScrollableControl implementation.
This seems to be a trivial task - just override OnKeyDown method, right? Not quite :( This basically means that I'd have to manually handle all possible key combinations with SHIFT or ALT (for non-english alphabets).
So the question is: is there an easy way to do it? Note that not only text input is required, but also backspace, enter, cursor movement and all that stuff. I feel I'm missing something and manual input handling through OnKeyDown is not exactly the best solution.
Depending on how you want the text input to work, you can probably do it by adding a borderless textbox to your control and focusing it when the user starts typing.
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?