Fix layout file properties with proper tab loading.

This commit is contained in:
KillzXGaming 2019-12-10 17:03:18 -05:00
parent 0c58133531
commit a09db22b48

View file

@ -65,22 +65,17 @@ namespace LayoutBXLYT
} }
private STPropertyGrid propertyGrid; private STPropertyGrid propertyGrid;
private object activeProperty;
public void LoadProperties(object properties) public void LoadProperties(object properties)
{ {
Reset(); Reset();
MaterialMode = false; MaterialMode = false;
AddTab("Properties"); activeProperty = properties;
if (propertyGrid == null || propertyGrid.Disposing || propertyGrid.IsDisposed) AddTab("Properties", LoadPropertyData);
{ stToolStrip1.Items[0].PerformClick();
propertyGrid = new STPropertyGrid();
propertyGrid.Dock = DockStyle.Fill;
stPanel1.Controls.Add(propertyGrid);
}
propertyGrid.LoadProperty(properties, ProperyChanged);
} }
private void ProperyChanged() private void ProperyChanged()
@ -178,7 +173,8 @@ namespace LayoutBXLYT
else else
tabIndex = Runtime.LayoutEditor.NullPaneTabIndex; tabIndex = Runtime.LayoutEditor.NullPaneTabIndex;
stToolStrip1.Items[tabIndex].PerformClick(); if (tabIndex < stToolStrip1.Items.Count)
stToolStrip1.Items[tabIndex].PerformClick();
Loaded = true; Loaded = true;
} }
@ -214,6 +210,13 @@ namespace LayoutBXLYT
Runtime.LayoutEditor.NullPaneTabIndex = tabIndex; Runtime.LayoutEditor.NullPaneTabIndex = tabIndex;
} }
public void LoadPropertyData(object sender, EventArgs e)
{
UpdateTabIndex();
propertyGrid = GetActiveEditor<STPropertyGrid>();
propertyGrid.LoadProperty(activeProperty, ProperyChanged);
}
public void LoadAnimationData(object sender, EventArgs e) public void LoadAnimationData(object sender, EventArgs e)
{ {
UpdateTabIndex(); UpdateTabIndex();