Skip to main content
Elliot James Chong
Participant
June 14, 2009
Question

Tabbing / TabStop Question

  • June 14, 2009
  • 1 reply
  • 670 views

I've been reading through the documentation on the RichText class to learn more about how the TLF is handling tabbing and discovered it's now based on a traditional Tab Stop system.  By default if no tab stops are defined the class treats a \t as a new line; however, I'd like to extend the behavior to act more like a 'typical' tabbing situation even if you haven't explicitly defined tab stops.  Specifically, I was interested in creating a simple code-editor component which would allow for an unlimited number of tab stops as the user inputs data.  The method of having to pass in a vector of tab stops obviously poses a problem.

I'm currently leaning towards doing a check everytime the tab key is pressed to see if a tabStop exists after the carrot's location, then if one is not present generate new tabStops up to and one interval beyond the carrot's location.  I think this should work for the most part (copying and pasting tabs would break), but if there is a better way to approach the problem (or a way to change the behavior to a system other than predefined tab stops) I'd love to hear it!  Thanks for your time!

This topic has been closed for replies.

1 reply

Adobe Employee
June 15, 2009

Your approach doesn't really work if other editing operations occur.  For example select all and change point size.

Better I think would be to find the maximum container width, create TabStops appropriate for that width and assign them to the TextFlow as the default tab stops.

Hope that helps,

Richard