MMKD
asked on
Synchronize Multiple Textbox Scrolling
Is it possible to synchronize 2 text boxes so that they will both always be on the same 'line' as each other even though they will contain different data...? The reason is because I have 2 text boxes and the data in each coordinates with the data in other on a line by line basis... Using normal multi line text boxes, and if possible is it possible with RTB as well?
Thanks In Advanced
Mark
Thanks In Advanced
Mark
ASKER
I would use a list box, but there are some problems with that. I need to beable to drag to select data accrost multiple lines being the major problem.. I'm starting to wonder if the only way for this to work would be to start subclassing and sending messages between each textbox....
please elaborate ur point
its not clear
its not clear
ASKER
To make it easier to understand. Im trying to make a Hex Editor controll... Sort of... So for example like in a hex editor you have 2 text boxes, one containing your hex data, and one containing the Ascii, I want so when i scroll in one text box, both text boxes scroll at the same time, so the data in each text box maches up with the data in the other text box... I hope that helps make it a little more clear :/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nice, almost exactly what i need arif eqbal, i was trying to use the SB_Lineup / SB_LineDown messages but that was doing me no good, and am using SB_Bottom for auto-scroll of text boxes. Altho i have one more question for you. Is there an easy way to get the number of lines in a text box? And the current line at which the text box is at? Or should i calculate this by looking for CrLf's?
ASKER
Also to add to that my last comment, also the total number of lines in the text box if there is a easier way than calculating via crlf's...?
Thanks
Thanks
Send a message EM_GETLINECOUNT ......
Private Const EM_GETLINECOUNT = &HBA
then
SendMessage(TextBox1.hwnd,
This will give you the no. of lines
I forgot to get current line
Private Const EM_LINEFROMCHAR = &HC9
SendMessage(TextBox1.hwnd, EM_LINEFROMCHAR, -1&, ByVal 0&)
we are sending -1 in wParam so the current line will be returned (0 based so add 1)
you can also pass a char in that line if it is unique and it will give you the line no.
Private Const EM_LINEFROMCHAR = &HC9
SendMessage(TextBox1.hwnd,
we are sending -1 in wParam so the current line will be returned (0 based so add 1)
you can also pass a char in that line if it is unique and it will give you the line no.
ASKER
Thanks for all your help Arif_eqbal, everything working perfect.
ie: lstBox1.listindex = lstBox2.listindex
easy