How to disable a listbox select feature?

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
qwertyCoder
Posts: 40
Joined: Wed May 07, 2008 4:37 pm
Location: Asheville, NC, USA

How to disable a listbox select feature?

Post by qwertyCoder »

Is there a way to make a list box unable to select anything? Im using a listbox as a sort of chat log, so there is no need to select anything, but Im not finding an option to disable selections or the like. Any ideas other than implementing a separate GUI object?
---------------------------------------

Code: Select all

int main()
{
	if (bCodeDoesntWork)
	{
		int res = AttemptFix(this);
		if (failed(res))
		{
			PullHair();
		}
	}
}
---------------------------------------
qwertyCoder
Posts: 40
Joined: Wed May 07, 2008 4:37 pm
Location: Asheville, NC, USA

Post by qwertyCoder »

Additionally, Im trying to get the text inside the listbox to be bigger, setItemHeight seems to only set the height of each list item, not the font size. Im not finding any font references in the gui elements...
o.O I would have thought that font face and size would have been implemented much in the same way each items color can be changed.
---------------------------------------

Code: Select all

int main()
{
	if (bCodeDoesntWork)
	{
		int res = AttemptFix(this);
		if (failed(res))
		{
			PullHair();
		}
	}
}
---------------------------------------
CuteAlien
Admin
Posts: 9935
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

The listbox is using the IGUISkin-font. Can't override that currently.
With setEnabled(false) you can disable input for the listbox, although it will probably also affect the colors. Otherwise you can also try to catch mouse-events in your event-receiver when the listbox has the focus or the mouse is above it . In that case it's probably best to take a look at CGUIListBox::OnEvent (in CGUIListBox.cpp) to check which events are used.

Or use a custom gui-element for your chat.

Also search around the forum - there are other chat-implementations already I think.
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
qwertyCoder
Posts: 40
Joined: Wed May 07, 2008 4:37 pm
Location: Asheville, NC, USA

Post by qwertyCoder »

Can the gui element such as a listbox be derived and certain functions overloaded? or would i have to code one from scratch following the default listbox structure? o.O
---------------------------------------

Code: Select all

int main()
{
	if (bCodeDoesntWork)
	{
		int res = AttemptFix(this);
		if (failed(res))
		{
			PullHair();
		}
	}
}
---------------------------------------
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

You can inherit from IGUIListBox, but there are >20 pure virtuals you have to implement. :) So you basically have to copy a lot of stuff.
Never take advice from someone who likes to give advice, so take my advice and don't take it.
qwertyCoder
Posts: 40
Joined: Wed May 07, 2008 4:37 pm
Location: Asheville, NC, USA

Post by qwertyCoder »

Well if Im going to go that far I suppose it would behoove me to simply create a custom gui element that contains both the chat history as well as the chat entry edit box and functions to handle various features....question is, to do that should i inherit from guielement and have members for each actual item (history and edit) or should i inherit from listbox and add a child in the constructor that is a pointer to the edit box? o.O
---------------------------------------

Code: Select all

int main()
{
	if (bCodeDoesntWork)
	{
		int res = AttemptFix(this);
		if (failed(res))
		{
			PullHair();
		}
	}
}
---------------------------------------
Post Reply