From 25b9449794f48f7b3306cc679863f4281f3e5136 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 1 Mar 2011 13:27:32 +0000 Subject: [PATCH] --- PROMS/Volian.Controls.Library/StepRTB.cs | 75 +++++++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 790e8909..83b176b5 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -22,10 +22,18 @@ namespace Volian.Controls.Library public delegate bool StepRTBBooleanEvent(object sender, EventArgs args); public delegate void StepRTBLocationEvent(object sender, StepRTBLocationEventArgs args); public delegate void StepRTBMouseEvent(object sender, MouseEventArgs args); + public delegate void StepRTBRoEvent(object sender, StepRTBRoEventArgs args); //public delegate void StepRTBMouseWheelEvent(object sender, MouseEventArgs args); public partial class StepRTB : RichTextBox // , IStepRTB { + private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + #region Events + public event StepRTBRoEvent RoInsert; + public void OnRoInsert(object sender, StepRTBRoEventArgs args) + { + if (RoInsert != null) RoInsert(sender, args); + } public event StepRTBEvent ReturnToEditor; public void OnReturnToEditor(object sender, EventArgs args) { @@ -141,6 +149,10 @@ namespace Volian.Controls.Library } #endregion #region Properties and Variables + public bool IsRoTable + { + get { return (Parent is VlnFlexGrid && (Parent as VlnFlexGrid).IsRoTable); } + } public bool HasVScroll { get @@ -584,7 +596,6 @@ namespace Volian.Controls.Library { if (ReadOnly) return; } - public bool inRoAdd = false; void StepRTB_SelectionChanged(object sender, EventArgs e) { //Console.WriteLine("StepRTB_SelectionChanged id= {0}", MyItemInfo.ItemID); @@ -2789,7 +2800,26 @@ namespace Volian.Controls.Library return Rtf; } #endregion - + #region RoInsertInterface + public void UpdateStepRtb(string linktxt, string valtxt) + { + int ss = SelectionStart; // Remember where the link is being added + int sl = SelectionLength; + OnReturnToEditor(this, new EventArgs()); + Select(ss, sl); + InsertRO(valtxt, linktxt); // Insert the LINK + OnDoSaveContents(this, new EventArgs()); // .SaveText(); // Save the text with the LINK - This also moves the cursor to the end of the text + // By selecting a starting position within a link, StepRTB (HandleSelectionChange) will select the link + Select(ss + 7 + valtxt.Length, 0);// Select the link, Try 7 for "