defocus components removed from scrollpanels, to prevent crashes

This commit is contained in:
jacob1 2013-01-10 12:02:54 -05:00
parent 17302f03c7
commit f814d264b2
3 changed files with 4 additions and 1 deletions

View File

@ -82,6 +82,8 @@ void Panel::RemoveChild(Component* c)
{
//remove child from parent. Does not free memory
children.erase(children.begin() + i);
if (this->GetParentWindow()->IsFocused(c))
this->GetParentWindow()->FocusComponent(NULL);
break;
}
}

View File

@ -48,6 +48,7 @@ LocalSaveActivity::LocalSaveActivity(SaveFile save, FileSavedCallback * callback
filenameField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
filenameField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
AddComponent(filenameField);
FocusComponent(filenameField);
ui::Button * cancelButton = new ui::Button(ui::Point(0, Size.Y-16), ui::Point(Size.X-75, 16), "Cancel");
cancelButton->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;