Question

I have a text area on which I would like to listen to change events when I change the text formatting using setFormatOfRange(). So far all other events I have tried, such as Event.CHANGE or TextOperationEvent.CHANGE are only dispatched when the actual text is changed.

Anyone know what I should be listening for ?

Was it helpful?

Solution

Actually you can get TextOperationEvent.CHANGE when formatting is change, but only if you use EditManager. You should create an EditManager object and assigns to TextArea.textFlow.interactionManager and all your format operation should be performed through this EditManager object. It has methods like applyFormat.

And I do not recommend using setFormatOfRange because it's pretty slow for large number of format operation. Instead you should use EditManager or ApplyFormatOperation objects. here's a post in which is explained how to use ApplyFormatOperation objects

OTHER TIPS

TextArea (or any other text controls for that matter) doesn't fire any events for changes in text formatting. Even the text change events are fired only when the text is changed manually by the user - not when you change it programmatically.

The TextOperationEvent class represents events that are dispatched when text content changes due to user operations such as inserting characters, backspacing, pasting, or changing text attributes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top