event characters - objective-c

What event character is the return key? for example:
If I used "[event characters]" and pressed "a" and then enter, what would come up? When I check it's just "a" and a space. but how would I simulate a return press in a string value?
Thanks,
Elijah

Related

Determine initial text selection in DataGridView Cell

A little question on use of DataGridView.
When I enter a Cell, text is all selected (in blue in the example). But I want to set the caret position at the right side of the text, for my user can delete the last character without clicking twice to place caret.
Have you some idea, because I don't find the good property...
I try to change behaviour when I enter in cell (edit with F2, in simple click), but test is always all select
Use DataGridView1.CellClick event and BeginEdit to allow casting Cell in textbox. After that set cursor position using textbox.select (from,Length) :
Private Sub cellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
DataGridView1.BeginEdit(False)
Dim tbCell As TextBox = CType(DataGridView1.EditingControl, TextBox)
tbCell.Select(tbCell.Text.Length, 0)
End Sub
The functioning of DataGridView has always been a problem for me.
tuyau2poil, your answer was perfect for my first question. I integred the code in DataGridView_CellDoubleClick and it's OK. Thousand of thanks
For my second question, I think the way is on Jimy anwser:
Now I search, when I select the cell with 1 click and press "Del", to delete the last character. That works, but when I type a new character + Enter, that delete all the cell for write only the new charactere.
This is for my users have to modify only the last number of the serial number enter in cell...
"21000_001" to become "21000_002" with "Del" + key press "2" + Enter .
Actually I've got "21000_001" then "2"
I think solution is arount of DataGridView_EditingControlShowing
Thanks

Use SendKeys to send Alt combinations to enter special characters

I want to send an Alt combination to another window within a on-screen keyboard.
With combination I mean when you hold down Alt and enter a number or hexadecimal(registry key has to be set for hex) combination:
ALT down, Add press, 2 press, 5 press, 1 press, ALT up
I tried
SendKeys.SendWait("%{ADD}251") but it's Alt+Add 2 5 1
SendKeys.SendWait("%{ADD}%2%5%1") but it's Alt+Add Alt+2 Alt+5 Alt+1
SendKeys.SendWait("%({ADD}251)") but it's Alt and then the other keys pressed simultaneously
Ref to MSDN
Any suggestions for a solution with SendKeys or other classes?
[Edit]
Solution:
Example for CharCode (Element of enum Source): ʊ = &H28A
Dim CharCodeUnicodeStr As String = Hex(CInt([Enum].Parse(GetType(Source), CharStr))).ToString
SendKeys.SendWait("%{ADD}%" & ChrW(Convert.ToInt32(CharCodeUnicodeStr, 16)))
Put the keys within parentheses to indicate that ALT should be held down while pressing the others.
SendKeys.SendWait("%({ADD}251)")
Have you tried
SendKeys.SendWait("%{ADD}%" & ChrW(&H251))
This will convert your hexa code into a char. Then if you have control over the other application you can revert this char back to a number...

Remove last character from textbox on button click

I have a textbox, textbox1, whose ReadOnly property is set to true. It is somewhat like an on-screen keyboard. When the user presses a button, I can add characters by using:
Textbox1.Text = Textbox1.Text & A
But, when the user wants to remove the text, which should work exactly like the Backspace key, the last character should be removed from the textbox.
I am ready to give up normal textbox and use richtextbox if there is any way ahead with the rich one.
How to remove last character of a textbox with a button?
The previously suggested SubString method is what I would have posted too. However, there is an alternative. The Remove method works by removing every character after the given index. For instance:
TextBox1.Text = Textbox1.Text.Remove(TextBox1.Text.Length - 1)
You can use the SubString method to get all but the last character, for instance:
TextBox1.Text = TextBox1.Text.SubString(0, TextBox1.Text.Length - 1)
The above functions such as Substring and Remove are not executed in Visual Basic 6 (or earlier versions). I recommend to use Mid function.
For instance,in this example last character of Hello is deleted and rest of word is saved in Text1
Text1=Mid("Hello",1, Len("Hello") - 1)
and result is Text1=Hell

VB Masked Textbox Loses Digit

I have a masked textbox in VB.NET to input a time value. I've tried the masks 90:00, 00:00, and ##:##. The first time a value is entered in the box, it inputs fine. I later clear the text with
mskTime.Text = ""
I've also tried
mskTime.Clear()
mskTime.ResetText()
The issue is after the text is cleared and a new time is entered, the first character typed is deleted. More precisely, when I add the time 12:34, I type the 1, it appears in the first character slot. I then press 2, and the 1 disappears and the 2 appears in the second character slot. The character does not disappear when you go to type it again to fix it.
Has anyone seen this issue or know why the first character disappears?
Problem found:
I had a KeyDown function to handle the user pressing enter in the time field:
If e.KeyCode = Keys.Enter Then
Schedule()
e.SuppressKeyPress = True
End If
Commenting out
e.SuppressKeyPress = True
solves the issue. I originally used that to prevent Windows from making a ding sound each time enter was pressed.
I had the exact same problem in C#. The input worked fine until the MaskedTextBox was cleared programmatically. After that the first character entered in one of the MaskedTextBoxes was deleted after a second character has been entered. Turned out that the problem lied within the KeyDown event. I was waiting for the Enter-Key there, did some stuff and cleared the TextBoxes. After that, the problem occured.
I solved it now by replacing the KeyDown-Event with a KeyPress-Event.
Here is what I ended up using to catch the Enter Key and move to the next field and not screw up the masked textbox when I come back to it.
Douglas
private void TxtLocID_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Enter)
{
e.Handled = true;
SendKeys.Send("{Tab}");
}
}

Selenium: delete contents from a textbox

Through selenium. how to delete contents from textbox.
I have to delete the last 2 characters from text box using selenium command.
Ex.ABCD to AB.
Try this -
selenium.type("text_box_object", "ABCD");
selenium.typeKeys("text_box_object", "\b");
selenium.typeKeys("text_box_object", "\b");
The keyPress event of selenium can be helpful:
selenium.sendKeys("text1", "ABCD");
selenium.sendKeys("text1", "\b");
selenium.sendKeys("text1", "\b");
This will Click Backspace key twice.
Read the current value and store it as a variable. Then 'Type' out the value that you want in the target field (using a substring of the stored value).
For firefox, the backspace event works only if you setCursorPosition at the END of the text in the textarea, otherwise the typeKeys event will type at the begining of the text.
Click onto it, hit end key and backspace twice