[.net] How to display active cursor on 2 textBoxes at the same time?

Started by
9 comments, last by chrisliando 16 years, 2 months ago
I am using Visual C++ Express Edition 2005. How to display active cursor/caret on 2 textBoxes at the same time? The purpose is so that user can insert / append text from textBox Source to textBox Target without to move from one side to another. Thank you very much..
Advertisement
You cant. But you can use Control.Focus to move between the two controls however which way you want. Obviously you don't want it jumping back and forth otherwise input will appear randomly in each textbox. You will need some sort of method to control which textbox should receive input.

I'm not really sure what your trying to achieve since you don't explain it in much detail. But if you want textbox1 to also place input into textbox2, then in the TextChanged event for textbox1 just copy the textbox1.Text into textbox2.Text.
You could presumably send fake WM_SETFOCUS messages to the two boxes. There'd still be only one which actually got keyboard input, though.
It's my senior who asked me to make thing like that.

When I heard that, I also confused if it is possible to be implemented.

The details of my application is like this:

I have 2 textBoxes, Target and Source. There are also 2 buttons: Append and Insert.

If I click Append, the selected text on Source will be appended to the end of Target. If I click Insert, the selected text on Source will be inserted to the ACTIVE CURSOR OF TARGET OR REPLACE THE SELECTED TEXT ON TARGET.

So that's why my Senior wants me to display active cursor on both textBoxes.

How to do that?

Thank you very much..
I don't have my IDE or MSDN open right now, but isn't there some sort of ContentChanged event handler on the textbox? As soon as the content of the text box changes, you could copy those changes over to the second textbox accordingly.
Lol I'm not helping you do your bloody homework. Go read a book or something!
You mean TextChanged? I have successfully done the part of Insert and Append.

The only part that has not been finished is to show the active cursors on both textBoxes.

How to do that?

Thank you very much..
As Headkaze said, you can't. Only one control can be active at a time. If whoever is telling you otherwise can show how it can be done, I'd like to see it.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

I agree with you...That's why I am now confused thinking how to do that..I think he has done it successfully so that he could told me to do the same thing.

Are you sure you haven't heard something like this before?

I'll tell you how to do that if I have been successfull..

Thank you very much.
I won't be holding my breath, waiting for you. [grin]

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

This topic is closed to new replies.

Advertisement