Large text boxes?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
dgrafix
Posts: 116
Joined: Sun Nov 18, 2007 2:36 pm

Large text boxes?

Post by dgrafix »

How can i create a large text edit box? I have found the multiline state but it puts the text halfway down and there are no scrollers :/

Is there a gui element to do this?
C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com :)
DeM0nFiRe
Posts: 117
Joined: Thu Oct 16, 2008 11:59 pm

Post by DeM0nFiRe »

Yep, all you have to do is call "setMultiLine()" Like this:

Code: Select all

editbox->setMultiLine(true);
dgrafix
Posts: 116
Joined: Sun Nov 18, 2007 2:36 pm

Post by dgrafix »

I have done that but once the box fills up it no scroll bars appear. Also the text seems to always start halfway down.
C++/Irrlicht Noob pl3se B p4t1ent.
Visit www.d-grafix.com :)
CuteAlien
Admin
Posts: 9933
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

setTextAlignment allows you to set the text alignment - vertical alignment is centered by default.

With setAutoScroll you can allow users to scroll around with cursor keys. Scrollbars are not part of IGUIEditbox but an own guielement. Also right now it's not possible to control scrolling in the editbox from outside.

If you need more advanced stuff you can also add your own guielement. Start for example by copying the sources of CGUIEditBox and then add whatever feature you need.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
project23
Posts: 4
Joined: Mon Apr 12, 2010 8:28 pm

Post by project23 »

I know this subject is over a year since last comment but I also wanted a quick and easy scratchpad inside my irrlicht toy. Here is an example I figured out from the api documentation and I thought I would share. It is really neat how text highlighting and Control-C(copy)/Control-V(paste) works in the scratchpad.

Code: Select all

void createScratchPad() //create a giant edit box to use as a scratch pad
{
		IGUIWindow* ScratchPadWindow = Device->getGUIEnvironment()->addWindow(core::rect<s32>(23,40,325,342),false,L"Scratchpad");
		IGUIEditBox* ScratchPadBox = Device->getGUIEnvironment()->addEditBox(L"", core::rect<s32>(0,20,300,300), true, ScratchPadWindow);
		ScratchPadBox->setMultiLine(true);
		ScratchPadBox->setWordWrap(true);
		ScratchPadBox->setTextAlignment(EGUIA_UPPERLEFT, EGUIA_UPPERLEFT);
		ScratchPadBox->setAutoScroll(true);
}

ignore me if I'm doing something stupid. I'm learning.
Post Reply