How can i use TAB in a text/editbox?

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Ralf/pdx
Just popping in
Just popping in
Posts: 19
Joined: Mon Mar 05, 2007 15:13

How can i use TAB in a text/editbox?

Postby Ralf/pdx » Wed Apr 01, 2009 14:28

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?

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Wed Apr 01, 2009 19:21

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).

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Postby CrazyEddie » Thu Apr 02, 2009 08:33

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.

Ralf/pdx
Just popping in
Just popping in
Posts: 19
Joined: Mon Mar 05, 2007 15:13

Postby Ralf/pdx » Mon Apr 06, 2009 12:00

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).


Return to “Help”

Who is online

Users browsing this forum: No registered users and 25 guests