Page 1 of 1

Problem with Listbox

Posted: Tue Aug 15, 2006 16:36
by killzone721
I don't know what happenning, but when i create a listbox, it crashes :(

My code:

[code]
CEGUI::Listbox* work= (CEGUI::Listbox*)CEGUI::WindowManager::getSingleton().getWindow("ChatWindow/ListBox");
CEGUI::ListboxTextItem *listboxitem = new CEGUI::ListboxTextItem("MessageToDisplay");
work->addItem(listboxitem);
work->ensureItemIsVisible(win3->getItemCount());
work->show();
mEditorGuiSheet->addChildWindow(win3);
[/code]

My xml:

<?xml version="1.0" ?>
- <GUILayout>
- <Window Type="DefaultWindow" Name="ReceiveChatWindow">
<Property Name="Position" Value="x:0.0 y:0.00" />
<Property Name="Size" Value="w:1.000000 h:0.900000" />
- <Window Type="TaharezLook/Listbox" Name="ChatWindow/ListBox">
<Property Name="Position" Value="x:0.05 y:0.03" />
<Property Name="Size" Value="w:0.9 h:0.1" />
</Window>
- <Window Type="TaharezLook/Editbox" Name="ChatWindow/EditBox2">
<Property Name="Position" Value="x:0.05 y:0.8" />
<Property Name="Size" Value="w:0.9 h:0.05" />
</Window>
</Window>
</GUILayout>

Re: Problem with Listbox

Posted: Tue Aug 15, 2006 17:40
by Xirnohn
killzone721 wrote:I don't know what happenning, but when i create a listbox, it crashes :(

My code:

Code: Select all

CEGUI::Listbox* work= (CEGUI::Listbox*)CEGUI::WindowManager::getSingleton().getWindow("ChatWindow/ListBox");
       CEGUI::ListboxTextItem *listboxitem = new CEGUI::ListboxTextItem("MessageToDisplay");
       work->addItem(listboxitem);
       work->ensureItemIsVisible(win3->getItemCount());
      work->show();
      mEditorGuiSheet->addChildWindow(win3);



What is win3? Becouse you use it and maybe unicialized.

My code:

Code: Select all

TexFilter = (CEGUI::Combobox*)Wmgr->getWindow("OptionsDialog/Graphics/TexFilter");
  TexFilter->addItem(new CEGUI::ListboxTextItem("None"));
  TexFilter->addItem(new CEGUI::ListboxTextItem("Bilinear"));
  TexFilter->addItem(new CEGUI::ListboxTextItem("Trilinear"));
  TexFilter->addItem(new CEGUI::ListboxTextItem("Anisotropic"));

Posted: Tue Aug 15, 2006 18:55
by killzone721
Ok so i remoeved the xml file and created my own window, however it still crashes ......... :S

My code:

CEGUI::Listbox* TexFilter = (CEGUI::Listbox*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/ListBar", (CEGUI::utf8*)"VideoListBox");

TexFilter->addItem(new CEGUI::ListboxTextItem("None"));
TexFilter->addItem(new CEGUI::ListboxTextItem("Bilinear"));
TexFilter->addItem(new CEGUI::ListboxTextItem("Trilinear"));
TexFilter->addItem(new CEGUI::ListboxTextItem("Anisotropic"));

What am i doing wrong that it crashes

Posted: Tue Aug 15, 2006 19:13
by Xirnohn
killzone721 wrote:CEGUI::Listbox* TexFilter = (CEGUI::Listbox*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/ListBar", (CEGUI::utf8*)"VideoListBox");


Are you using TaharezLook/ListBar? I dont find any widget with this name, maybe TaharezLook/ListBox?

Xir.

Posted: Tue Aug 15, 2006 20:13
by killzone721
ok it compiles now, thanks to you but it doesn't show............................ :S


My code:

CEGUI::Combobox* objectComboBox = (CEGUI::Combobox*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Combobox", (CEGUI::utf8*)"VideoListBox");
objectComboBox->addItem(new CEGUI::ListboxTextItem("None"));
objectComboBox->addItem(new CEGUI::ListboxTextItem("Bilinear"));
objectComboBox->addItem(new CEGUI::ListboxTextItem("Trilinear"));
objectComboBox->addItem(new CEGUI::ListboxTextItem("Anisotropic"));
mEditorGuiSheet->addChildWindow(Multiplayerbutton);
objectComboBox->setAlwaysOnTop(true);
objectComboBox->show();
objectComboBox->setPosition(CEGUI::Point(0.0f, 0.0f));
objectComboBox->setSize(CEGUI::Size(1.0f, 1.0f));

what do you think i am doing wrong

Posted: Tue Aug 15, 2006 20:49
by Xirnohn
killzone721 wrote:CEGUI::Combobox* objectComboBox = (CEGUI::Combobox*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Combobox", (CEGUI::utf8*)"VideoListBox");
objectComboBox->addItem(new CEGUI::ListboxTextItem("None"));
objectComboBox->addItem(new CEGUI::ListboxTextItem("Bilinear"));
objectComboBox->addItem(new CEGUI::ListboxTextItem("Trilinear"));
objectComboBox->addItem(new CEGUI::ListboxTextItem("Anisotropic"));
mEditorGuiSheet->addChildWindow(Multiplayerbutton);
objectComboBox->setAlwaysOnTop(true);
objectComboBox->show();
objectComboBox->setPosition(CEGUI::Point(0.0f, 0.0f));
objectComboBox->setSize(CEGUI::Size(1.0f, 1.0f));


mEditorGuiSheet->addChildWindow(Multiplayerbutton);
With this you added the Multiplayerbutton, where are you add the objectComboBox? You created it here, but i dont see where are you add it to the GuiSheet.

Xir.

Posted: Tue Aug 15, 2006 20:51
by Trentin
Looks like

Code: Select all

mEditorGuiSheet->addChildWindow(Multiplayerbutton);


should be

Code: Select all

mEditorGuiSheet->addChildWindow(objectComboBox);

Posted: Tue Aug 15, 2006 20:53
by Xirnohn
Trentin wrote:Looks like

Code: Select all

mEditorGuiSheet->addChildWindow(Multiplayerbutton);


should be

Code: Select all

mEditorGuiSheet->addChildWindow(objectComboBox);


Yes, thats what i suggested. :)

Posted: Tue Aug 15, 2006 23:14
by killzone721
Thanks to all for helping me, it was that silly mistake, one more question how do you edit the looknfeel file. I tried by changing the file type to txt file, however it seems that txt file is not designed to read the looknfeel format, what should i do?