This commit is contained in:
Kathy Ruffing 2011-02-08 11:29:26 +00:00
parent 1e71d60ae2
commit 9474d194c8

View File

@ -963,18 +963,22 @@ namespace Volian.Controls.Library
linktxt = string.Format("#Link:Transition:{0} <NewID> {1}", listBoxTranFmt.SelectedIndex, toItem.ItemID); linktxt = string.Format("#Link:Transition:{0} <NewID> {1}", listBoxTranFmt.SelectedIndex, toItem.ItemID);
} }
// Can I build the text right now? // Can I build the text right now?
trantxt = TransitionText.GetResolvedText(_MyRTB.MyItemInfo, listBoxTranFmt.SelectedIndex,toItem,rangeItem ?? toItem); trantxt = TransitionText.GetResolvedText(MyRTB.MyItemInfo, listBoxTranFmt.SelectedIndex,toItem,rangeItem ?? toItem);
int ss = _MyRTB.SelectionStart;// Remember where the link is being added int ss = MyRTB.SelectionStart;// Remember where the link is being added
_MyRTB.InsertTran(trantxt, linktxt);// Insert the LINK int sl = MyRTB.SelectionLength;
_MyRTB.SaveText();// Save the text with the LINK - This also moves the cursor to the end of the text MyRTB.OnReturnToEditor(this, new EventArgs());
MyRTB.Select(ss, sl);
MyRTB.InsertTran(trantxt, linktxt);// Insert the LINK
MyRTB.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 // By selecting a starting position within a link, StepRTB (HandleSelectionChange) will select the link
_MyRTB.Select(ss + 7 + trantxt.Length, 0);// Try 7 for <Start] and the length of the transition text MyRTB.Select(ss + 7 + trantxt.Length, 0);// Try 7 for <Start] and the length of the transition text
//Console.WriteLine("'{0}'",_MyRTB.Text.Substring(_MyRTB.SelectionStart,_MyRTB.SelectionLength)); //Console.WriteLine("'{0}'",_MyRTB.Text.Substring(_MyRTB.SelectionStart,_MyRTB.SelectionLength));
string linkText = _MyRTB.Text.Substring(_MyRTB.SelectionStart, _MyRTB.SelectionLength); string linkText = MyRTB.Text.Substring(MyRTB.SelectionStart, MyRTB.SelectionLength);
if(_MyLog.IsInfoEnabled && (linkText.Contains("NewID") || linkText.Contains("CTID"))) if(_MyLog.IsInfoEnabled && (linkText.Contains("NewID") || linkText.Contains("CTID")))
_MyLog.InfoFormat("ItemID {0}, LinkText '{1}'", _MyRTB.MyItemInfo.ItemID, linkText); _MyLog.InfoFormat("ItemID {0}, LinkText '{1}'", MyRTB.MyItemInfo.ItemID, linkText);
_MyRTB.Select(_MyRTB.SelectionStart + _MyRTB.SelectionLength, 0);// Move cursor to end of LINK int sel = MyRTB.SelectionStart + MyRTB.SelectionLength;
_MyRTB.Focus(); MyRTB.Select(sel, 0);// Move cursor to end of LINK
MyRTB.Focus();
} }
#endregion #endregion
#region VariousSupportMethods #region VariousSupportMethods