List Box with Editable Text

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
krama757
Posts: 451
Joined: Sun Nov 06, 2005 12:07 am

List Box with Editable Text

Post by krama757 »

I'm not sure why this wasnt included as a function, but this is a nice easy change to be able to change the text in a list box after it has been initialized.

Add these lines in -->
In CGUIListBox.h:

Code: Select all

//! sets the text of a particular index to something new
virtual void setSelectedText(s32 id, const wchar_t* text); 
In IGUIListBox.h:

Code: Select all

//! sets the text of the selected item
void setSelectedText(s32 id, const wchar_t* text);
In CGuiListBox.cpp:

Code: Select all

void CGUIListBox::setSelectedText(irr::s32 id, const wchar_t *new_text){
	Items[id].text = new_text; 
}
Recompile the irrlicht solution and use the new dll and lib files. Have fun! :)

===========
P.S My first change to irrlicht! Wooot! :)
Post Reply