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.

This commit is contained in:
Rich 2008-02-27 20:13:32 +00:00
parent ee9acb929d
commit a39536739b
2 changed files with 33 additions and 44 deletions

View File

@ -435,7 +435,7 @@ namespace Volian.Controls.Library
//_DisplayRTB.Leave += new EventHandler(_DisplayRTB_Leave); //_DisplayRTB.Leave += new EventHandler(_DisplayRTB_Leave);
//_DisplayRTB.GotFocus += new EventHandler(_DisplayRTB_GotFocus); //_DisplayRTB.GotFocus += new EventHandler(_DisplayRTB_GotFocus);
//_DisplayRTB.LostFocus += new EventHandler(_DisplayRTB_LostFocus); //_DisplayRTB.LostFocus += new EventHandler(_DisplayRTB_LostFocus);
_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick); //_DisplayRTB.MouseClick += new MouseEventHandler(_DisplayRTB_MouseClick);
if (item != null) if (item != null)
{ {
_Type = (int)item.MyContent.Type; _Type = (int)item.MyContent.Type;
@ -532,10 +532,10 @@ namespace Volian.Controls.Library
_Loading = false; _Loading = false;
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add"); //// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add");
} }
void _DisplayRTB_MouseClick(object sender, MouseEventArgs e) //void _DisplayRTB_MouseClick(object sender, MouseEventArgs e)
{ //{
_DisplayRTB.Select(); // _DisplayRTB.Select();
} //}
//void _DisplayRTB_Enter(object sender, EventArgs e) //void _DisplayRTB_Enter(object sender, EventArgs e)
//{ //{
// _Panel._ItemSelected = _MyItem; // _Panel._ItemSelected = _MyItem;
@ -950,13 +950,11 @@ namespace Volian.Controls.Library
private void _DisplayRTB_Enter(object sender, EventArgs e) private void _DisplayRTB_Enter(object sender, EventArgs e)
{ {
_Panel.DisplayRTB = _DisplayRTB; _Panel.DisplayRTB = _DisplayRTB;
_Panel.ItemSelected = _MyItem; //_Panel.ItemSelected = _MyItem;
} }
//private void veRichTextBoxText_Leave(object sender, EventArgs e) //private void veRichTextBoxText_Leave(object sender, EventArgs e)
//{ //{
//} //}
private void _DisplayRTB_LinkModifyTran(object sender, LinkClickedEventArgs e) private void _DisplayRTB_LinkModifyTran(object sender, LinkClickedEventArgs e)
{ {
_Panel.OnLinkModifyTran(sender, new DisplayLinkEventArgs(this, e)); _Panel.OnLinkModifyTran(sender, new DisplayLinkEventArgs(this, e));

View File

@ -162,6 +162,7 @@ namespace Volian.Controls.Library
get { return _DisplayRTB; } get { return _DisplayRTB; }
set set
{ {
value.BackColor = ActiveColor; // Set the active color
if (_DisplayRTB == value) return; // Same - No Change if (_DisplayRTB == value) return; // Same - No Change
if (_DisplayRTB != null) if (_DisplayRTB != null)
{ {
@ -169,15 +170,22 @@ namespace Volian.Controls.Library
_DisplayRTB.SaveText(); // Save any changes to the text _DisplayRTB.SaveText(); // Save any changes to the text
} }
_DisplayRTB = value; _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; internal ItemInfo _ItemSelected;
public ItemInfo ItemSelected public ItemInfo ItemSelected
{ {
@ -185,16 +193,20 @@ namespace Volian.Controls.Library
set set
{ {
_ItemSelected = value; _ItemSelected = value;
//if (value == null)
//{
// OnItemSelectedChanged(this, null);
// return;
//}
//_LastItemSelected = value;
int id = value.ItemID; int id = value.ItemID;
ExpandAsNeeded(value); ExpandAsNeeded(value);
ItemLookup[id].ItemSelect(); DisplayItem itm = ItemLookup[id];
OnItemSelectedChanged(this, new DisplayPanelEventArgs(ItemLookup[id], null)); _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 public DisplayItem DisplayItemSelected
@ -222,24 +234,6 @@ namespace Volian.Controls.Library
} }
set { _Settings = value;} 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 private int _MaxRNO = -1; // TODO: Need to calculate MaxRNO on a section basis rather than for a panel
public int MaxRNO public int MaxRNO
{ {
@ -376,9 +370,6 @@ namespace Volian.Controls.Library
} }
} }
#endregion #endregion
} }
[TypeConverter(typeof(ExpandableObjectConverter))] [TypeConverter(typeof(ExpandableObjectConverter))]
public partial class DisplayPanelSettings public partial class DisplayPanelSettings