PDA

View Full Version : HTML Text Edit


jhambley@mac.co
04-10-2004, 09:25 AM
I have the need to allow users to enter text into as multiline text and then select certain text with the mouse and apply HTML fomating tags to that text.

For example:

1. The user types in "Hello World. I'm really enjoying the day".
2. Selects the words "really enjoying" using the mouse
3. Clicks on a button called "Bold" and the code adds the <b> and </b> tags into the text so the text can be displayed later in a view as bolded.

Is this possible? Has anyone written an simple HTML editor like this?

antun
04-12-2004, 10:10 AM
You could write something like this, but it would be a little tricky: Differing formatting (e.g. bold and plain) in inputtexts is not supported, however you could find a way around this by creating separate inputtext/text elements and positioning them on screen, to look like a single text element.

Inputtext has the methods getSelectionPosition() and getSelectionSize(), to determine what the user has selected.

-Antun