50%-TextArea

I want to build 2 TextAreas that show the SAME content (styled text), BUT: the content of TextArea1 should be exact the half of the size of TextArea2.

And if I change the text in TextArea1 it should be immediately changed in the corresponding TextArea2 and vice versa.

Any idea how this could be done?

Hank

Perhaps .DrawInto and have the half size version as a canvas?
Do you need both to be editable?

It’s not necessary for the second to be editable

Place two TextArea in a window: the second being half the size of the first.
Set TextArea1.TextSize to 24 / and TextArea2.TextSize to 12
Add Change event in both TextArea
Add code in TextArea1.Change to copy its contents into TextArea2
Do the same in TextArea2

Not tested, so check the code and how to’s in language reference for TextArea.

Is is enough ?

BE CAREFUL.

If you put code in the CHANGE event of both textarea to update the OTHER text area, you will create an infinite loop

You need to include a BOOLEAN flag to control WHEN/IF an update should occur. It should only be triggered by the TextArea that recieved its change from an external source.

Hey,

DAVE IS RIGHT !!!

BEWARE

[quote=40113:@Emile Schwarz]Place two TextArea in a window: the second being half the size of the first.
Set TextArea1.TextSize to 24 / and TextArea2.TextSize to 12
[/quote]
This doesn’t work with styled text, which could have multiple sizes in the same text box (if you set the secon textarea’s RTFData to the first, they will be the same size regardless of their textSize property value). You would have to loop through the style runs and set the size to half, although I don’t know how well that would work. I believe that the TextArea control can display RTF formatting that is not settable through the styledText parameters, so it may strip this formatting out if it is not compatible with the RTF data properties.