Link to home
Create AccountLog in
Avatar of emsp
emspFlag for Norway

asked on

Creating a text component with an interactive line counter

I'm planning to create a new text component to use in my program, that has an interactive line counter. Please see the attached image for an example.

Now, I do _not_ want finished code for something like this, but what I'm looking for is a nod in the right direction, a plan so to speak. To create that kind of component, I've though of the following possibility;

1. Create a split container with no borders.
2. Create a Rich Text Box in the left column, set to "Disabled" for it to be greyed out, and so that the user cant move the carrot to it. I also thought it would be smart to use the RTB since it also supports images.
3. A normal Text Box in the left column.
4. A function in my new component that sets the font size. This will then set the font size on both text boxes, so that the lines match.

What I can't quite figure out though in this solution, is how to work the scrollbars. Is it possible to set it so that the scrollbar only appears within the left column Text Box (as opposed to the picture example, where it expands both), and that moving the vertical scrollbar will also move the right scrollbar?

Are there a better way to creating such a component?
component.jpg
Avatar of jandromeda
jandromeda
Flag of Sri Lanka image

ASKER CERTIFIED SOLUTION
Avatar of cottsak
cottsak
Flag of Australia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of emsp

ASKER

Although it WAS all the sourcecode I needed, I can certainly learn from trying to rewrite this as I need it to be, with image support etc.

Thanks alot :)
no probs mate. hav fun.