From 95af37950711c33bb3e808ff8c7d34e684b8b4a4 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 22 Mar 2012 17:26:25 +0000 Subject: [PATCH] Fixed problem when after inserting a RO in a table cell, the table cell reverted back to view mode. --- PROMS/Volian.Controls.Library/GridItem.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/PROMS/Volian.Controls.Library/GridItem.cs b/PROMS/Volian.Controls.Library/GridItem.cs index 516e18b6..f972fdd1 100644 --- a/PROMS/Volian.Controls.Library/GridItem.cs +++ b/PROMS/Volian.Controls.Library/GridItem.cs @@ -116,6 +116,7 @@ namespace Volian.Controls.Library } void MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args) { + //Console.WriteLine("MyStepRTB_AdjustTableWidth"); //if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) if (args.EditMode) { @@ -167,6 +168,7 @@ namespace Volian.Controls.Library } void MyStepRTB_ReturnToEditor(object sender, EventArgs args) { + //Console.WriteLine("MyStepRTB_ReturnToEditor"); MyFlexGrid.Focus(); MyFlexGrid.StartEditing(); } @@ -180,6 +182,7 @@ namespace Volian.Controls.Library } void MyStepRTB_EditModeChanged(object sender, EventArgs args) { + //Console.WriteLine("MyStepRTB_EditModeChanged"); AdjustColorsForEditMode(); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid(); } @@ -314,6 +317,7 @@ namespace Volian.Controls.Library //} void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args) { + //Console.WriteLine("GridItem - Enter MyStepRTB_RoInsert"); if (MyFlexGrid.IsRoTable) { MyFlexGrid.Visible = false; @@ -329,7 +333,18 @@ namespace Volian.Controls.Library //SaveContents(); } else + { + int sel = MyStepRTB.SelectionStart + args.ValText.Length;// +args.LinkText.Length;//MyStepRTB.SelectionLength; // Remember where the link is being added + //Console.WriteLine("ValText {0} LinkText {1}", args.ValText, args.LinkText); + //Console.WriteLine("selstart {0} len {1}", MyStepRTB.SelectionStart, args.LinkText.Length); + CellRange cr = MyFlexGrid.Selection; MyStepRTB.UpdateStepRtb(args.LinkText, args.ValText); + MyFlexGrid.StartEditing(cr.r1, cr.c1); // get back to edit mode + MyStepRTB.Select(sel, 0);// Move cursor to end of LINK + SendKeys.Send("{RIGHT}"); // this will un-select the RO + SendKeys.Flush(); + } + //Console.WriteLine("GridItem - Exit MyStepRTB_RoInsert"); } void MyStepRTB_GotFocus(object sender, EventArgs e) { @@ -351,6 +366,10 @@ namespace Volian.Controls.Library //ItemWidth = (int)GetTableWidth(MyStepRTB.Font, MyItemInfo.MyContent.Text, true); //ItemWidth = MyFlexGrid.Width; //ItemLocation = new Point(50, _MyParentEditItem.Bottom); + + // We had a table that was in a funky state. This allows it to appear in editor so + // that is could be deleted. + if (_MyParentEditItem == null) return; Point newLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth); if (!newLocation.Equals(ItemLocation)) ItemLocation = newLocation; }