SpellCheck Functionality in Textbox - c#

I have an issue in Spellchecking the text that is entered in a textbox in wpf 3.5
<TextBox Name="tbxBack" SpellCheck.IsEnabled="True"/>
It will Check fine for the wrongly spell words in the sentence that I have entered in the text box, but when I right click on the wrongly spell word and try to make correct, it is only making the first word correct in the sentence.
for example:
the sentence is:
tey are plaing in playgroun (They are playing in playground)
when I right click on "tey", system is giving the appropriate results and setting the correct value ("They" for "tey"),
but when I right click on "plaing", system gives the correct values, but does not set it to correctvalue ("playing").
same for "playgroun" (doesn't set to playground), System is checking only the first word.
How to make it work for the whole sentence?

Related

Label displays punctuation incorrectly with RightToLeft

I'm trying to learn C# and .NET by creating a calculator app. However, I'm seeing some weird behavior with WinForms label and punctuation. My app has a series of number buttons, a "period" button for decimals, and various operators. When you press a button, I add the value to the label that is displaying the value:
displayLbl.Text += selectedButton.Text;
or
displayLbl.Text += ".";
The label has RightToLeft set to "true" to mimic the display of a typical calculator.
However, when a period first appears in the label, it appears ahead of the rest of the numbers that were added before it. For example, it will look like ".456" even though the "456" was added earlier. As soon as you add another number, the period will then appear back in its right place like "456.7".
This also happens with the negative sign (-). If you add "-478" to the label, it will appear as "478-".
This seems really buggy. Is there any way to fix this?
I set RightToLeft to "No" and then did the following and it worked beautifully:
this.displayLbl.TextAlign = System.Drawing.ContentAlignment.MiddleRight;

WPF TextBox Focus on the end of the text at all times unless arrow keys are pressed

I'm trying to make a simple calculator, and it has to focus on the last number so that when the text is too long, the user can still see what he/she is typing. Also, when the caret is not at the end of the string (arrow keys used), pressing a number button will put it back to the end of the string.
How do you do this?
Set the CaretIndex to the end of input like this when text input is received.
TextBoxName.CaretIndex = TextBoxName.Text.Length - 1;
If you’re trying to create a calculator like that in Windows10, then the textbox should be read only. You can set the TextAlignment to Right to display the text from right as in Windows calculator.
Since the textbox is readonly, when user clicks on some number that string needs to be concatenated to the textbox. The logic is very simple.
You can google for wpf calculator and find some good examples.
If you’re having a 2 textbox and 1 result textbox type calculator, then you can follow the method I mentioned above to achieve the expected behavior.

Is it possible to define "Word boundary" characters for a text box?

(I cannot believe this has never been asked; most likely I failed at searching.)
Having a single line WinForms TextBox control with content in it:
When the user uses Ctrl+→ or Ctrl+←, the caret moves to the very end respectively very beginning of the content of the text box.
My goal
I want to configure the text box so that navigating with the above keys (or in addition with Shift), the caret stops at word boundaries.
E.g. when the caret is at position 0 and the user presses Ctrl+Shift+→ it would look like this:
I.e. it selects the first "word" only.
The standard behaviour is:
I.e. it selects the whole text.
Interestingly enough, the native Windows controls like e.g. in the "Run" dialog behave as described:
The address bar of Edge or Internet Explorer or even Windows Explorer also stops at word boundaries.
My question
Is it possible (maybe through P/Invoke) to configure certain stop characters for the TextBox control?
Update 1
I could think of handling keyboard events and doing this manually.
To answer your question.. definitely, but I wouldn't know how.
But
There is a control that has the behavior you're looking for, namely the RichTextBox.
It has the behavior you are asking for and has a property for disabling the default multiline behavior.
Properties to make the RichTextbox look like a regular textbox
Multiline - false
DetectUrls - false
height - 20
Note:
The richTextBox does NOT have autocomplete out of the box, like the regular textbox does.

In MaskedTextBox, how do I write a mask to check that the input is none empty?

As far as I can tell, this is none regex. And I can't find anywhere for quantifier. This is what I have right now, which the MaskedTextBox does not recognize the + as a quantifier
A+
You are trying to validate the masked text box too early. You can't know that it doesn't have any input until it doesn't have input. I assume that you have some sort of form that you are having a user fill in and at the end they press a button to complete the data entry. You can validate the input within that event.
If you just want to ensure non-empty then you can check the TextLength field after focus leaves the textbox, or when a button is pushed, etc..

Can I insert text into the console input buffer?

To start off, I don't even know if I used the proper terminology. What I'm talking about is let's say I have a program that displays the value of a string and it also allows me to edit the value. What I want to do is when I begin to edit the value, the original value will be placed in my input so it'll be as if I manually typed in the original value and am able to use backspace and stuff.
It's like I just changed the value to a very long sentence and I realized I misspelled one word so when I edit the value the original pops up so I can use the arrow keys to move to the word and fix it, instead of having to retype the entire sentence.
I think you want to use a C# wrapper for the curses terminal control library.

Categories

Resources