Page 1 of 1
How can i use TAB in a text/editbox?
Posted: Wed Apr 01, 2009 14:28
by Ralf/pdx
I have got a string with TAB´s which i want to display in a EditBox.
It seems that CEGUI displaces all TAB´s with just one SPACE char.
Is there any chance to show the TAB´s correctly?
Posted: Wed Apr 01, 2009 19:21
by Jamarr
afaik there is no built-in support for tabs.
Also, when you inject a character into cegui it only checks the font to see if a codepoint is available for that character, and if it does not have one it is not even added to the string. In otherwords, it is up to your font to determine how the character is displayed. For example, while your font displays a space, my font displays nothing.
I'm not sure how difficult it would be to add this into cegui. I know that CEGUI can detect tabs, as you can pass CEGUI::Key::Tab into the inject methods; but how you tell cegui to 'render 4 spaces' (or whatever) when it encounters a tab, I have no idea; you would also have to adjust the left/right arrow key behavior to account for this (assuming the user can move the cursor).
Posted: Thu Apr 02, 2009 08:33
by CrazyEddie
Yeah, what constitutes a 'tab' is not something that's particularly simple to add. The correct implementation of a tab is a 'stop' point at a physical location offset from the start of a line, so just adding 'x' amount of space would not be acceptable for many people.
I'm not sure how you'd do it in for a freetype font, but one semi-solution could be to define an image for the 'tab' character that is empty except for the horizontal advance - which would move the start point of the characters following the tab.
I think once the extended text rendering is added implementing a tab will be much simpler, and (possibly) be included by default.
CE.
Posted: Mon Apr 06, 2009 12:00
by Ralf/pdx
Thanks for your answers.
It seems i have to wait for the extended text rendering because the "empty image" solution is not a real solution for my case (i have also text before the TAB´s).