ComboBox delete item problem

NickM

01-04-2009 18:29:15

I have a ComboBox that I have added a couple of items to, I'm then trying to clear the box and add some new items, I tried just calling
ComboBox->clearItems()
but once I've added the new items, as soon as I open the dropdown I get a crash on the last line in
void Window::updateTexturePosition()
{
// Remember that Windows are their own texture, thus their "screen" position is zero.

mTexturePosition = Point::ZERO;

// Update component screen dimensions, must be done after client and screen rect have been calculated
for(std::map<Ogre::String,Widget*>::iterator it = mComponents.begin(); it != mComponents.end(); ++it)
{
(*it).second->updateTexturePosition();
}

// Update children screen dimensions, must be done after client and screen rect have been calculated
for(std::vector<Widget*>::iterator it = mChildren.begin(); it != mChildren.end(); ++it)
{
(*it)->updateTexturePosition();


I also tried just clearing the items several times in a row without opening the dropdown and I get a crash on the last line here
Widget* ContainerWidget::findWidget(const Ogre::String& name)
{
Widget* w;
for(std::vector<Widget*>::iterator it = mChildren.begin(); it != mChildren.end(); ++it)
{
w = (*it)->findWidget(name);

In the above crash it cant find the auto named widget.

I thought I'd then try destroying the items by calling
ComboBox->destroyItem(i)
but that crashes on the last line here
void ComboBox::destroyItem(unsigned int index)
{
Factory<Widget>* widgetFactory = FactoryManager::getSingleton().getWidgetFactory();

bool updateItems = false;
float yPos = 0;
int count = 0;
for(std::list<ListItem*>::iterator it = mItems.begin(); it != mItems.end(); ++it)


I'm going to look into it more after my dinner but thought I'd see if I'm doing something wrong, sorry to be a pain. :(

kungfoomasta

01-04-2009 18:35:08

Not a pain, these are important issues to raise! From the last snippet of code I can see the code base is probably 9.03 or earlier. I'm going to upload 9.04 now, methods for deleting and creating Widgets have changed some. I'm not sure if this would fix the issue or not, but I will test against this tonight and see if there is an issue.

NickM

01-04-2009 18:39:17

Yes, I forgot to mention that it is 9.03
I'll try 9.04 once it's available, thanks for the very quick reply.

kungfoomasta

02-04-2009 08:59:09

I found a problem with ComboBox::clearItems, its fixed now. I've re-uploaded 9.04 with this change. Let me know if there are more problems! (sorry for more problems with ComboBox :( )

NickM

02-04-2009 17:31:46

Ok I'll give it a try, thank you. :)