Hi.
I made a Combobox, and when I make a loop to fill the combobox with items, sometimes it works sometimes not. When it not works, the program just close, without error messages, anything.
Can anyone help me?
I tried the following code:
Combobox* vmCombo = (Combobox*)WMngr->createWindow("AquaLook/Combobox", "VMCombobox");
ListboxTextItem* item;
string Test[4] = {"testA", "testB", "testC", "testD"};
for(int i = 0; i < 4; ++i)
{
item = new ListboxTextItem(Test[i]);
vmCombo->addItem((ListboxItem*) item);
}
Error in ListboxTextItem
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Hi,
I'm not certain as to why this might be happening from the information provided. When the program does not run correctly is the CEGUI.log created? If so, are there any errors in there?
Also, please ensure you correctly catch CEGUI::Exceptions and either deal with them or output the message. Otherwise the program may appear to just close (as you are experiencing).
For example:
Aside from this, you will likely have to debug into the program to determine the point of failure and perhaps post again once you have more information.
Having said all this, the issue is highly likely to be related to the use of a cast in the code posted here, and the issue you describe in your other post (which I'll reply to shortly ).
CE.
I'm not certain as to why this might be happening from the information provided. When the program does not run correctly is the CEGUI.log created? If so, are there any errors in there?
Also, please ensure you correctly catch CEGUI::Exceptions and either deal with them or output the message. Otherwise the program may appear to just close (as you are experiencing).
For example:
Code: Select all
try
{
// CEGUI code segment
}
catch (CEGUI::Exception &e)
{
printf("CEGUI Error: %s", e.getMessage().c_str());
}
Aside from this, you will likely have to debug into the program to determine the point of failure and perhaps post again once you have more information.
Having said all this, the issue is highly likely to be related to the use of a cast in the code posted here, and the issue you describe in your other post (which I'll reply to shortly ).
CE.
-
- Just popping in
- Posts: 15
- Joined: Thu Nov 06, 2008 18:44
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Replying here as per the other thread for completeness (in case anyone searches in the future)...
While addItem takes a pointer to a ListboxItem, the class ListboxTextItem is a subclass of ListboxItem and so passing its pointer to a function that accepts pointers to the superclass is valid C++ (meaning both should work).
CE.
While addItem takes a pointer to a ListboxItem, the class ListboxTextItem is a subclass of ListboxItem and so passing its pointer to a function that accepts pointers to the superclass is valid C++ (meaning both should work).
CE.
Who is online
Users browsing this forum: No registered users and 8 guests