IGUIEditBox now with Scrollbars and other stuff

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
Mloren
Posts: 114
Joined: Mon Aug 07, 2006 2:30 am
Location: Australia
Contact:

IGUIEditBox now with Scrollbars and other stuff

Post by Mloren »

So I have added scroll bars and a bunch of stuff to IGUIEditBox's.

I have made a patch file but I am working out of the 1.7 SVN branch, not sure if its compatible with the trunk or other versions, it probably is as I don't think these files changed that much.

Patchfile can be downloaded here:

Download

Changes:

* Now has a vertical scroll bar that can be enabled with setVScrollbarEnabled()
* Contains bug fix for weird scrolling issue (see this thread: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=42417)
* The mouse wheel now scrolls the edit box while it has focus. setMouseWheelScrollAmount() can be used to set how much it scrolls by. Defaults to 3 lines which seems to be standard in windows.
* Added setCursorPos() functions which can be used to set where the blinking text cursor is. There are two different versions, one that lets you set by line and position within that line and one that sets by character index.
* You can also get the current cursor position with getCursorPos() functions.
* Added a getMaxScroll() function which returns the maximum scroll value of the scroll bar for use in conjunction with:
* setCurrentScroll() which lets you set the scroll bars current position.

Use and enjoy :)
Mloren
Posts: 114
Joined: Mon Aug 07, 2006 2:30 am
Location: Australia
Contact:

Post by Mloren »

I have updated the patch to fix a bug. (The text in a non-multiline box was jiggling up and down when you typed in it)
tebreh
Posts: 2
Joined: Tue Dec 07, 2010 2:17 pm

Post by tebreh »

How Can I add this in my irrlicht?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: IGUIEditBox now with Scrollbars and other stuff

Post by CuteAlien »

Just some notes as I'm now sitting on that stuff:
- Please always one feature per patch. Putting more than one feature inside a single patch makes it nearly impossible to read it as I have no idea which line belongs to which feature without double and tribble-reading every single line. And features are always added one-by-one as it's otherwise not possible to test them.
- It would be nice to test patches before posting them. I can see some problems without tests, but in general the rule in programming is: As long as it's not tested it won't work correct. In this case I could see for example on a quick-view that setCursorPos doesn't care about the difference between CursorPosition and text-index (they are not the same because of newlines), but in writing tests I found several more problems in the editbox already.
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
Post Reply