Fixed section list to position on current sub-section

This commit is contained in:
John Jenko 2014-01-20 17:31:31 +00:00
parent 0b6204b506
commit ef32061c72

View File

@ -143,7 +143,7 @@ namespace Volian.Controls.Library
// Find the procedure level first. // Find the procedure level first.
while (tmpitm.MyContent.Type != 0) while (tmpitm.MyContent.Type != 0)
{ {
if (tmpitm.MyContent.Type >=10000 && tmpitm.MyContent.Type<20000) secitm = tmpitm; if (tmpitm.MyContent.Type >=10000 && tmpitm.MyContent.Type<20000 && secitm == null) secitm = tmpitm;
tmpitm = tmpitm.MyParent; tmpitm = tmpitm.MyParent;
} }
_CurrentProcedure = tmpitm; _CurrentProcedure = tmpitm;
@ -480,7 +480,7 @@ namespace Volian.Controls.Library
int active = cbTranSects.Items.Add(secitm); int active = cbTranSects.Items.Add(secitm);
if (secitm.ItemID == secstart) cbTranSects.SelectedIndex = active; if (secitm.ItemID == secstart) cbTranSects.SelectedIndex = active;
} }
if (secitm.Sections != null && secitm.Sections.Count > 0) cbTranSectsFillIn(secitm.Sections[0], -1, false); if (secitm.Sections != null && secitm.Sections.Count > 0) cbTranSectsFillIn(secitm.Sections[0], secstart, false);
secitm = (secitm.NextItem != null && secitm.NextItems.Count > 0 ? secitm.NextItems[0] : null); secitm = (secitm.NextItem != null && secitm.NextItems.Count > 0 ? secitm.NextItems[0] : null);
} }
@ -707,7 +707,7 @@ namespace Volian.Controls.Library
ItemInfo secitm = null; ItemInfo secitm = null;
while (tmpitm.MyContent.Type != 0) // find current section while (tmpitm.MyContent.Type != 0) // find current section
{ {
if (tmpitm.MyContent.Type >= 10000 && tmpitm.MyContent.Type < 20000) secitm = tmpitm; if (tmpitm.MyContent.Type >= 10000 && tmpitm.MyContent.Type < 20000 && secitm == null) secitm = tmpitm;
tmpitm = tmpitm.MyParent; tmpitm = tmpitm.MyParent;
} }
int sectstartid = FindSectionStart(_CurrentProcedure); int sectstartid = FindSectionStart(_CurrentProcedure);