From 2ec5e1b8dc7bed480d363b05c05a71af8bfc6833 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 26 Apr 2011 12:01:15 +0000 Subject: [PATCH] --- PROMS/Volian.Controls.Library/StepPanel.cs | 26 +++++++++---------- PROMS/Volian.Controls.Library/StepTabPanel.cs | 7 ++++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs index ba3434c8..b922252f 100644 --- a/PROMS/Volian.Controls.Library/StepPanel.cs +++ b/PROMS/Volian.Controls.Library/StepPanel.cs @@ -77,7 +77,7 @@ namespace Volian.Controls.Library { if (ItemClick != null) ItemClick(sender, args); } - private bool ItemSelectionChangeShown = false; // This keeps OnItemSelectedChanged from being called twice when an item is selected. + public bool ItemSelectionChangeShown = false; // This keeps OnItemSelectedChanged from being called twice when an item is selected. /// /// Occurs when the selected EditItem changes /// @@ -349,19 +349,19 @@ namespace Volian.Controls.Library get { return _SelectedItemInfo; } set { - //vlnStackTrace.ShowStack("SelectedItemInfo {0} => {1}",_SelectedItemInfo, value); _SelectedItemInfo = value; - int id = value.ItemID; - ExpandAsNeeded(value); - // reset the entire step panel if the item isn't found. - if (!_LookupEditItems.ContainsKey(id)) Reset(); - EditItem itm = _LookupEditItems[id]; - ItemSelectionChangeShown = false;//OnItemSelectedChanged has not run yet. - itm.ItemSelect(); - if (!ItemSelectionChangeShown) OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(itm)); - //vlnStackTrace.ShowStack("_ItemSelected = {0}", _ItemSelected.ItemID);// Show StackTrace + ItemSelectionChangeShown = false; //OnItemSelectedChanged has not run yet. + SelectedEditItem.ItemSelect(); + if (!ItemSelectionChangeShown) OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(SelectedEditItem)); } } + public EditItem GetEditItem(ItemInfo itemInfo) + { + ExpandAsNeeded(itemInfo); + if (_SelectedItemInfo == null) _SelectedItemInfo = itemInfo; + if (!_LookupEditItems.ContainsKey(itemInfo.ItemID)) Reset(); + return _LookupEditItems[itemInfo.ItemID]; + } private bool _DisplayItemChanging = false; public bool DisplayItemChanging { @@ -384,9 +384,7 @@ namespace Volian.Controls.Library EditItem lastEI = _SelectedEditItem; if (value != null) value.SetActive(); // Set the active color if (lastEI == value) return; // Same - No Change - //RHM ToDo: Why doesn't it have focus for copy Step/Paste - if (value != null) value.SetFocus(); - + if (lastEI != null && lastEI.BeingDisposed == false) { bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty; diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.cs b/PROMS/Volian.Controls.Library/StepTabPanel.cs index f946948c..77eae63c 100644 --- a/PROMS/Volian.Controls.Library/StepTabPanel.cs +++ b/PROMS/Volian.Controls.Library/StepTabPanel.cs @@ -54,7 +54,12 @@ namespace Volian.Controls.Library public ItemInfo SelectedItemInfo { get { return _MyStepPanel.SelectedItemInfo; } - set { _MyStepPanel.SelectedItemInfo = value; } + set + { + _MyStepPanel.SelectedEditItem = _MyStepPanel.GetEditItem(value); + _MyStepPanel.SelectedEditItem.ItemSelect(); + if (!_MyStepPanel.ItemSelectionChangeShown) _MyStepPanel.OnItemSelectedChanged(this, new ItemSelectedChangedEventArgs(_MyStepPanel.SelectedEditItem)); + } } /// /// Currently Selected EditItem