Nifty GUI text fields

Hello guys,

i’m building a GUI for my game using nifty gui and stumbled accross some inconveniences. First of all, nifty gui seems to be not fully documented - i stumbled accros the fact that texts can be colored differently in the same text control only be reading through the old news on the nifty page - it is nowhere documented in the documentations.

Since those documentation seem not be be complete (to be honest, they cover only e very small piece of whats possible with nifty gui, i have realized that now), i wan’t to ask if someone has a solution for my problem:

I wan’t to create a text area with text, that has a fixed width and in which the text is automatically been wrapped and it uses as many lines as needed. Best case: i can set the alignement (left, right, center, justify) myself. The text does not need to be editable, it should only be displayed.

If i had such a thing, applying a scrollbar to it seems to be not the problem at all.

Does something like this exist? Or, if it doesn’t, what would be a good start if i was to implement it myself? (If i was able to create it i would commit it to the nifty library so that it can be included).

Any help would be appreciated.

Thanks in advance,


You you set the “wrap” attribute to “true” on the “<text>” element. This way Nifty will auto wrap the text. Setting a fixed width for the element is required in that case. Alignment should work already using the textHAlign attribute.

Sorry about the missing documentation. Maybe you can help? :slight_smile:

1 Like

Well, thanks for the info :wink:

I’ll try it out^^

Well, it is difficult to write documentations, if you don’t know what to write :S I’d be glad to help out, but at first i have to figure out what can be done, before i could possibly write down how i did that xD