From 2a585b7ac56f83aaf49a66e99c771b3348b6d923 Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 16 Oct 2012 14:46:03 +0000 Subject: [PATCH] Added additional Error Log output to follow what is happening. Added logic to attempt to fix layout issues when steps are expanded or collapsed. --- PROMS/Volian.Controls.Library/EditItem.cs | 63 ++++++++++++++--------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 7b49a12a..d797fccf 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1658,45 +1658,46 @@ namespace Volian.Controls.Library if (RNOLevel > 0 && AEREditItem != null) AEREditItem.AdjustLocation(); 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)) // 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, // _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) { - //int bottom = BottomMostEditItem.Bottom; - if (nextEditItem != null) + int bottom = nextEditItem.FindTop(Bottom); + if (nextEditItem.Top != bottom) { - //if (MyID == 2123) - // _LookForID = 2123; - int bottom = nextEditItem.FindTop(Bottom); + MyStepPanel.ItemMoving++; + nextEditItem.LastMethodsPush(string.Format("AdjustLocation {0}", MyID)); + 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 != null && !nextEditItem.Moving && nextEditItem.Top != bottom) { - MyStepPanel.ItemMoving++; - 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. + nextEditItem.TryAgainNow(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; - _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 { @@ -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); + } /// /// Automatically expands Steps if not currently expanded ///