There are two things you can't do with static text that are really bothering me:
1. You cannot click and drag over static text to highlight it so you can copy and paste it elsewhere.
2. you cannot set different colors within one piece of static text.
I am trying to use it for a chat window, and being able to copy text out of it would be handy and not being able to set different colors is very annoying.
I would like to have the speakers name in a different color to the text they say.
Doesn't look like there's a way to do this currently though.
Any chance of either of these being added?
Feature Reaquest - Increased Static Text functionality
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
I'm not the GUI maintainer, but IMHO not. Different colors would bloat the API and text color syntax too much. And selectable text is often not desired in places where static text is used.
Just search for the chat console implementations that have been made in the past. Should work for your cases pretty well.
Just search for the chat console implementations that have been made in the past. Should work for your cases pretty well.
I agree on the copy and paste. That's what edit boxes are made for.
But for the second point:
Maybe we could have some kind of parser that would allow use to add this functionality if we want. The built in one could just don't touch the text at all but if we want to we can exchange the parser with an own implementation where we could define our own syntax for coloring texts, switching fonts, and so on?
But for the second point:
Maybe we could have some kind of parser that would allow use to add this functionality if we want. The built in one could just don't touch the text at all but if we want to we can exchange the parser with an own implementation where we could define our own syntax for coloring texts, switching fonts, and so on?
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Mloren,
as a variant you can try to draw 2 separate IGUIStaticText objects: each with own color.
Next method allows to get width (in pixels) how much space the text (user name in your case) needs to be drawn, so you can draw second static text (user message in your case) right next to the previous text just by add an offset by X coord.
as a variant you can try to draw 2 separate IGUIStaticText objects: each with own color.
Next method allows to get width (in pixels) how much space the text (user name in your case) needs to be drawn, so you can draw second static text (user message in your case) right next to the previous text just by add an offset by X coord.
(c) http://irrlicht.sourceforge.net/docu/cl ... 1d4cba7e5ds32 irr::gui::IGUIStaticText::getTextWidth();
Returns the width of the current text, in the current font.
If the text is broken, this returns the width of the widest line.
I can't imagine why you would ever want static text to not be selectable.hybrid wrote:And selectable text is often not desired in places where static text is used.
It always bugs me when a program brings up an error or other message box and you cant select the text to copy and paste it (eg to paste it into google to find out what the error means).
The problem is they can also always be edited. What if I want text that can be selected/copied but not altered by user.Sylence wrote:I agree on the copy and paste. That's what edit boxes are made for.
It seems like either the static text should have an option to set it as selectable or the edit box should have an option to disable user altering.
Ok, as for colors: I guess that should rather be an own element.
But copying text would certainly be useful. I already have a bunch of other open patches for IGUIStaticText (mostly for scrolling), so when get to adding those I'll look into it.
But copying text would certainly be useful. I already have a bunch of other open patches for IGUIStaticText (mostly for scrolling), so when get to adding those I'll look into it.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm