GUIEditBox: insert/overwrite mode

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
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

GUIEditBox: insert/overwrite mode

Post by Acki »

hi,
I made some changes to the GUIEditBox for my IrrExtensions,
but I thought this could be of interest for Not-IrrExtension-Users too ;)

1st was get/setCursorPosition, but this is a preatty old one... ;)

now I made functions to set/get insert/overwrite mode for the edit box !!! 8)
also the cursor changes depending on the mode (like it's usual for edit boxes)...

you can download the patch file and an example here !!!
the patch was made with the official 1.7.2 release version...

I hope it's of any use for you, and maybe it finds it's way into the next release !!! :)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Nice, I'll take a look when I get to the editbox next time. There's also 3 patches from Mloren which I have on my todo for it (I think one was also for set cursor position) . I just have not found the time yet to write tests for those and also to check the editbox sources if there's any reason why setting position wasn't made public so far (always a problem figuring out such stuff if you didn't write it yourself...). I try if I can get to it this week. Hm, after I fix the bug with the spaces at the end for multiline-editboxes.
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
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Andres and I modified also the IGUIEditBox and used it as a code editor in our project. Would you like to have a look at it?

The scrolling was enhanced, we added color coding with terms, added a vertical scroller and linecount (hide/show) button...

The component started from the source (but we use it as a new gui component)
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

christianclavet wrote:Andres and I modified also the IGUIEditBox and used it as a code editor in our project. Would you like to have a look at it?

The scrolling was enhanced, we added color coding with terms, added a vertical scroller and linecount (hide/show) button...

The component started from the source (but we use it as a new gui component)
I guess it might be useful so if you put that in code-snippets people will like it. But with different colors and additional line-counting this already goes into the direction of a rich-edit which would rather be an own element already I guess.
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
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Post by christianclavet »

Hi, ok. I posted our code editor gui as a snippet here:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=44166
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: GUIEditBox: insert/overwrite mode

Post by CuteAlien »

@Acki, please check my comments on this thread: http://irrlicht.sourceforge.net/forum/v ... =9&t=42429
It's basically the same problems as in the patch here and just some simple hints to improve patches in future.
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
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: GUIEditBox: insert/overwrite mode

Post by Acki »

I see ;)
is the new package better then ???
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
CuteAlien
Admin
Posts: 9670
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: GUIEditBox: insert/overwrite mode

Post by CuteAlien »

Well, it still has the same bug (CursorPosition can't be text-length as it ignores newlines), but yes - this way patches are better.
Note: I'll probably rewrite textbreaking (or wrapping to use a more common name...) now first anyway, as this caused too many troubles and is copy-pasted in more than one class and needed in some further classes. And this might affect CursorPosition, although I probably keep the current system. I'm not sure yet if I should convert in some way between CursorPosition and TextPosition or how to handle that. Bascially if we add getCursorPosition then people would like to know where in the text this is probably.
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