Added additional Error Log output to follow what is happening.

Added logic to attempt to fix layout issues when steps are expanded or collapsed.
This commit is contained in:
Rich 2012-10-16 14:46:03 +00:00
parent 537213ee7a
commit 2a585b7ac5

View File

@ -1658,45 +1658,46 @@ namespace Volian.Controls.Library
if (RNOLevel > 0 && AEREditItem != null) if (RNOLevel > 0 && AEREditItem != null)
AEREditItem.AdjustLocation(); AEREditItem.AdjustLocation();
EditItem nextEditItem = NextDownEditItem; EditItem nextEditItem = NextDownEditItem;
//if (MyID == 2138)
// Console.WriteLine("2138");
//if (_WatchThis > 0 && MyID > _StartingID)
//if((nextEditItem == null ? 0 : nextEditItem.MyID) == MyID)
//if(_LookForID.Contains(MyID)) //if(_LookForID.Contains(MyID))
// Console.WriteLine("{0}AdjustLocation {1},{2},{3} -> {4},{5} ({6}) {7}", WatchThisIndent, MyID, MyItemInfo.Ordinal, MyPath, // Console.WriteLine("{0}AdjustLocation {1},{2},{3} -> {4},{5} ({6}) {7}", WatchThisIndent, MyID, MyItemInfo.Ordinal, MyPath,
// nextEditItem == null ? 0 : nextEditItem.MyID, nextEditItem == null ? 0 : nextEditItem.MyItemInfo.Ordinal, nextEditItem == null ? "Null" : nextEditItem.MyPath, // nextEditItem == null ? 0 : nextEditItem.MyID, nextEditItem == null ? 0 : nextEditItem.MyItemInfo.Ordinal, nextEditItem == null ? "Null" : nextEditItem.MyPath,
// _NextDownEditItemPath); // _NextDownEditItemPath);
//if (_WatchThis && MyID == 2119)
// Console.WriteLine("I'm here");
//if (MyID > 2120)
// Console.WriteLine("{0}\t{1}", MyID, nextEditItem == null ? 0 : nextEditItem.MyID);
if (nextEditItem != null) if (nextEditItem != null)
{ {
//int bottom = BottomMostEditItem.Bottom; int bottom = nextEditItem.FindTop(Bottom);
if (nextEditItem != null) if (nextEditItem.Top != bottom)
{ {
//if (MyID == 2123) MyStepPanel.ItemMoving++;
// _LookForID = 2123; nextEditItem.LastMethodsPush(string.Format("AdjustLocation {0}", MyID));
int bottom = nextEditItem.FindTop(Bottom); nextEditItem._NextDownEditItemPath = _NextDownEditItemPath;
float oldTop = nextEditItem.Top;
nextEditItem.ExpandPrefix = 0;// If I move then I have to move my children when I expand
// it appears that setting the top doesn't always work. The logic below checks to see if it does
// not work and trys some other things so that the EditItem will be moved to the correct place.
// As a last attempt, the EditItem is added to a list to be refreshed from a timer on MyStepPanel.
nextEditItem.Top = bottom;
if (nextEditItem.Top != bottom) if (nextEditItem.Top != bottom)
// if (nextEditItem != null && !nextEditItem.Moving && nextEditItem.Top != bottom)
{ {
MyStepPanel.ItemMoving++; nextEditItem.TryAgainNow(bottom);
nextEditItem.LastMethodsPush(string.Format("AdjustLocation {0}", MyID));
nextEditItem._NextDownEditItemPath = _NextDownEditItemPath;
nextEditItem.Top = bottom;
// We found that the 64 Bit version of windows did not always set the Top correctly.
// We also found that if we could simply watch for the next time that it was set, we
// could set the Flag "TryAgainLater" the change would propogate the changes through its
// children and siblings.
if (nextEditItem.Top != bottom) if (nextEditItem.Top != bottom)
{ {
_MyLog.InfoFormat("'TryAgainLater',{0},{1},{2},{3},{4},'{5}'",
oldTop, nextEditItem.Top, bottom, MyStepPanel.Height, nextEditItem.MyID, nextEditItem.MyItemInfo.ShortPath);
nextEditItem.TryAgainLater = true; nextEditItem.TryAgainLater = true;
_MyLog.InfoFormat("Setting nextEditItem.Top ({0}) = bottom ({1}) for ID {2}, ({3}) did not work, TryAgainLater", nextEditItem.Top, bottom, nextEditItem.MyID, nextEditItem.MyItemInfo.SearchPath); MyStepPanel.Height += 12;
} }
nextEditItem.LastMethodsPop();
MyStepPanel.ItemMoving--;
} }
else if ((nextEditItem.Bottom + MyStepPanel.VerticalScroll.Value + 1) > MyStepPanel.VerticalScroll.Maximum)
{
if (nextEditItem.Visible)
{
_MyLog.InfoFormat("Refresh Edit Item '{0}',{1},{2},{3},{4}", nextEditItem.MyItemInfo.ShortPath,
nextEditItem.Bottom, MyStepPanel.Height, MyStepPanel.VerticalScroll.Maximum, MyStepPanel.VerticalScroll.Value);
MyStepPanel.AddToRefreshList(nextEditItem);
}
}
nextEditItem.LastMethodsPop();
MyStepPanel.ItemMoving--;
} }
else else
{ {
@ -1704,6 +1705,18 @@ namespace Volian.Controls.Library
} }
} }
} }
public void TryAgainNow(int bottom)
{
TryToSetTop(bottom-10);
//TryToSetTop(bottom+10);
TryToSetTop(bottom);
}
private void TryToSetTop(int offset)
{
Top = offset;
if (Top != offset)
_MyLog.InfoFormat("Didn't work - Top {0} != offset {1}", Top, offset);
}
/// <summary> /// <summary>
/// Automatically expands Steps if not currently expanded /// Automatically expands Steps if not currently expanded
/// </summary> /// </summary>