From a39536739b735d313e45de03bd1eba861ddd41f6 Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 27 Feb 2008 20:13:32 +0000 Subject: [PATCH] There were a few issues with being able to select an item with the mouse. Primarily, there were methods tied to the enter event and the mouse-click event. --- PROMS/Volian.Controls.Library/DisplayItem.cs | 14 ++--- PROMS/Volian.Controls.Library/DisplayPanel.cs | 63 ++++++++----------- 2 files changed, 33 insertions(+), 44 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayItem.cs b/PROMS/Volian.Controls.Library/DisplayItem.cs index dd2847cc..c3ab694d 100644 --- a/PROMS/Volian.Controls.Library/DisplayItem.cs +++ b/PROMS/Volian.Controls.Library/DisplayItem.cs @@ -435,7 +435,7 @@ namespace Volian.Controls.Library //_DisplayRTB.Leave += new EventHandler(_DisplayRTB_Leave); //_DisplayRTB.GotFocus += new EventHandler(_DisplayRTB_GotFocus); //_DisplayRTB.LostFocus += new EventHandler(_DisplayRTB_LostFocus); - _DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick); + //_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick); if (item != null) { _Type = (int)item.MyContent.Type; @@ -532,10 +532,10 @@ namespace Volian.Controls.Library _Loading = false; //// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add"); } - void _DisplayRTB_MouseClick(object sender, MouseEventArgs e) - { - _DisplayRTB.Select(); - } + //void _DisplayRTB_MouseClick(object sender, MouseEventArgs e) + //{ + // _DisplayRTB.Select(); + //} //void _DisplayRTB_Enter(object sender, EventArgs e) //{ // _Panel._ItemSelected = _MyItem; @@ -950,13 +950,11 @@ namespace Volian.Controls.Library private void _DisplayRTB_Enter(object sender, EventArgs e) { _Panel.DisplayRTB = _DisplayRTB; - _Panel.ItemSelected = _MyItem; + //_Panel.ItemSelected = _MyItem; } //private void veRichTextBoxText_Leave(object sender, EventArgs e) //{ - //} - private void _DisplayRTB_LinkModifyTran(object sender, LinkClickedEventArgs e) { _Panel.OnLinkModifyTran(sender, new DisplayLinkEventArgs(this, e)); diff --git a/PROMS/Volian.Controls.Library/DisplayPanel.cs b/PROMS/Volian.Controls.Library/DisplayPanel.cs index 5a2e83fa..3f2073f8 100644 --- a/PROMS/Volian.Controls.Library/DisplayPanel.cs +++ b/PROMS/Volian.Controls.Library/DisplayPanel.cs @@ -162,6 +162,7 @@ namespace Volian.Controls.Library get { return _DisplayRTB; } set { + value.BackColor = ActiveColor; // Set the active color if (_DisplayRTB == value) return; // Same - No Change if (_DisplayRTB != null) { @@ -169,15 +170,22 @@ namespace Volian.Controls.Library _DisplayRTB.SaveText(); // Save any changes to the text } _DisplayRTB = value; - _DisplayRTB.BackColor = ActiveColor; + _ItemSelected = value.MyItem; + //AddExpandItem(_ItemSelected); + ExpandAsNeeded(_ItemSelected); + OnItemSelectedChanged(this, new DisplayPanelEventArgs(ItemLookup[_ItemSelected.ItemID], null)); + // Show StackTrace + //Console.WriteLine("_DisplayRTB = {0}", _DisplayRTB.MyItem.ItemID); + //StackTrace st = new StackTrace(true); + //StackFrame[] sfs = st.GetFrames(); + //int ii = 1; + //foreach (StackFrame sf in sfs) + //{ + // if (ii < 50 && sf.GetFileLineNumber() != 0) + // Console.WriteLine("{0}{1}", "".PadLeft(ii++ * 2), sf); + //} } } - - //private ItemInfo _LastItemSelected; - //internal ItemInfo LastItemSelected - //{ - // get { return _LastItemSelected; } - //} internal ItemInfo _ItemSelected; public ItemInfo ItemSelected { @@ -185,16 +193,20 @@ namespace Volian.Controls.Library set { _ItemSelected = value; - //if (value == null) - //{ - // OnItemSelectedChanged(this, null); - // return; - //} - //_LastItemSelected = value; int id = value.ItemID; ExpandAsNeeded(value); - ItemLookup[id].ItemSelect(); - OnItemSelectedChanged(this, new DisplayPanelEventArgs(ItemLookup[id], null)); + DisplayItem itm = ItemLookup[id]; + _DisplayRTB = itm.MyDisplayRTB;// This keeps the code above from repeating + itm.ItemSelect(); + OnItemSelectedChanged(this, new DisplayPanelEventArgs(itm, null)); + //StackTrace st = new StackTrace(true); + //StackFrame[] sfs = st.GetFrames(); + //int ii = 1; + //foreach (StackFrame sf in sfs) + //{ + // if (ii < 50 && sf.GetFileLineNumber() != 0) + // Console.WriteLine("{0}{1}", "".PadLeft(ii++ * 2), sf); + //} } } public DisplayItem DisplayItemSelected @@ -222,24 +234,6 @@ namespace Volian.Controls.Library } set { _Settings = value;} } - //void DisplayPanel_Layout(object sender, LayoutEventArgs e) - // { - // //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("layout {0} {1} {2} {3}", e.AffectedComponent.GetType().Name,e.AffectedControl.Name,e.AffectedProperty, sender.GetType().Name); - // } - //void DisplayPanel_Scroll(object sender, ScrollEventArgs e) - //{ - // //if(_MyLog.IsInfoEnabled)_MyLog.InfoFormat("scroll {0} {1} {2} {3}", e.OldValue, e.NewValue, e.ScrollOrientation,sender.GetType().Name); - // Scrolling = false; - //} - //public void AdjustOutOfRangeControls(int yAdjust) - //{ - // bool scrolling = Scrolling; - // Scrolling = true; - // foreach (Control control in Controls) - // if (control.GetType().Name == "vlnCSLARTB" && control.Top > Height) - // control.Top += yAdjust; - // Scrolling = scrolling; - //} private int _MaxRNO = -1; // TODO: Need to calculate MaxRNO on a section basis rather than for a panel public int MaxRNO { @@ -376,9 +370,6 @@ namespace Volian.Controls.Library } } #endregion - - - } [TypeConverter(typeof(ExpandableObjectConverter))] public partial class DisplayPanelSettings