I'have started a few weeks ago to learn irrlicht and to try something myself.
I need help with the event generated by a selected tree node in a gui treeview.
I try to make an "item catalog" with a treeview for listing items, a mesh viewer to offer a 3d view of the selected item and a last part with some staic text.
The problem is that I don't succeffuly make a way to retreive the selected item ID (by the selected tree node event gui::EGET_TREEVIEW_NODE_SELECT) from the EventReicever OnEvent() function.
Here is my function called when this event occur :
Code: Select all
void updateItemCatalogSelectedItem()
{
if(itemCatalogTree)
{
SItem* item = static_cast<SItem*>(itemCatalogTree->getSelected()->getData());
guienv->getRootGUIElement()->getElementFromId(GUI_ID_ITEMCATALOG_NAME)->setText(item->name);
std::cout << "SELECTED !" << std::endl;
}
}
"Data" is filled with a pointer to a structure SItem who hold infos about an item (just some s32 and wchar_t).
In this code, I just try to display the name of the selected item by updating the text on a IGUIStaticText element (GUI_ID_ITEMCATALOG_NAME).
Could anybody please help me understand the way i have to go to make this work ?
I don't find any topic on the web that speaks about this.
Thanks you
Amateria