Today I have a little question:
1) I'm writing code for managing dialogs with NPC and I selected TaharezLook/ListBox for variants of answers in dialog window.
2) I'm try to do something, but my code doesn't work:
Code: Select all
void CUIManager::_InitDialog()
{
m_WindowManager->getWindow("Root/NPSQuesting/Log")->setText("");
CEGUI::Listbox *vars = (CEGUI::Listbox*) m_WindowManager->getWindow("Root/NPSQuesting/AnswerVariants");
vector<string> answers=_pQuestManager->GetAnswers(-1);
//CEGUI::String str;
for (int i=0; i<answers.capacity(); i++)
{
//str.clear();
//str.append("ListboxItem");
//str+=(i+30);
CEGUI::Window* foo = m_WindowManager->createWindow("TaharezLook/ListboxItem", "");
vars->addChildWindow(foo);
//vars->addItem((CEGUI::ListboxItem*) foo);
((CEGUI::ListboxItem*)foo)->setOwnerWindow(vars);
}
vars->subscribeEvent(CEGUI::Listbox::EventMouseClick, new CEGUI::Event::Subscriber(&CUIManager::_AnswerVariantsHandler, this));
}
3) I think, I should use vars->addItem((CEGUI::ListboxItem*) foo);, but MSVC gives me an rtc error "The value of ESP was not properly saved across a function call."
4) And the last question: where are ListBoxItem parameters for setting up size and position? Should I re - define a ListBoxItem class?
Thank you!
P.S. Maybe there is another method for creating interactive dialogs windows?