- Home /
Populate Text Box until it's full
I would like to add text to a multi-line TextBox until the TextBox is full, accounting for current font-size. The size of the TextBox will be fixed but the text that is displayed will be variable. The idea is that I want to display text one page at a time, similar to how iBooks or Kindle works. A page (textbox) fills with text, keeping track of where it left off, and when the user swipes left it picks up where it left off and repeats the process for the next page.
I could imagine having a function that adds one word of text at a time until the textbox overflows, then remove the last word added. I don't know if it's possible to detect when the textbox overflows. Also to add one word at a time I would need to split the text using space as the separator, and then I might lose track of things like paragraph breaks. So maybe it's not the best way, I'm not sure.
Does anyone have a solution to this or can you point me to something in the API that would be useful? Thanks.