Jump to content
  • Advertisement
Sign in to follow this  
chrisliando

[.net] How to update textBox cursor position?

This topic is 3886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have 2 textBoxes which retrieve text file content, the one is the Source and the other is Destination. Destination is editable but Source is read-only. If I click button Insert, then the selected text from Source will be inserted to the position of active cursor. The question is how to update the cursor position after the insertion? It should moved right after the text inserted. How can I know the last position of the active cursor? Or is there any other way to do this? The insertion part is at the "else" block: Here is my code : if (textBox2->SelectedText != String::Empty) { textBox1->Copy(); textBox2->SelectedText = textBox2->SelectedText->Replace(textBox2->SelectedText,Clipboard::GetText()); textBox2->Focus(); textBox2->Select(textBox2->SelectionStart + Clipboard::GetText()->Length, 0); } else { // INSERTION PART textBox2->Text = textBox2->Text->Insert(textBox2->SelectionStart, textBox1->SelectedText); textBox2->Focus(); textBox2->Select(textBox1->SelectedText->Length - textBox2->SelectionStart,0); } Thank you very much..

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!