Fixed problem when after inserting a RO in a table cell, the table cell reverted back to view mode.

This commit is contained in:
John Jenko 2012-03-22 17:26:25 +00:00
parent 4f14509562
commit 95af379507

View File

@ -116,6 +116,7 @@ namespace Volian.Controls.Library
} }
void MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args) void MyStepRTB_AdjustTableWidth(object sender, StepRTBTableWidthEventArgs args)
{ {
//Console.WriteLine("MyStepRTB_AdjustTableWidth");
//if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure)) //if ((!_MyItemInfo.IsSection && !_MyItemInfo.IsProcedure) && (_MyItemInfo.IsTable || _MyItemInfo.IsFigure))
if (args.EditMode) if (args.EditMode)
{ {
@ -167,6 +168,7 @@ namespace Volian.Controls.Library
} }
void MyStepRTB_ReturnToEditor(object sender, EventArgs args) void MyStepRTB_ReturnToEditor(object sender, EventArgs args)
{ {
//Console.WriteLine("MyStepRTB_ReturnToEditor");
MyFlexGrid.Focus(); MyFlexGrid.Focus();
MyFlexGrid.StartEditing(); MyFlexGrid.StartEditing();
} }
@ -180,6 +182,7 @@ namespace Volian.Controls.Library
} }
void MyStepRTB_EditModeChanged(object sender, EventArgs args) void MyStepRTB_EditModeChanged(object sender, EventArgs args)
{ {
//Console.WriteLine("MyStepRTB_EditModeChanged");
AdjustColorsForEditMode(); AdjustColorsForEditMode();
MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid(); MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetRibbonForGrid();
} }
@ -314,6 +317,7 @@ namespace Volian.Controls.Library
//} //}
void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args) void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args)
{ {
//Console.WriteLine("GridItem - Enter MyStepRTB_RoInsert");
if (MyFlexGrid.IsRoTable) if (MyFlexGrid.IsRoTable)
{ {
MyFlexGrid.Visible = false; MyFlexGrid.Visible = false;
@ -329,7 +333,18 @@ namespace Volian.Controls.Library
//SaveContents(); //SaveContents();
} }
else 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); 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) 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 = (int)GetTableWidth(MyStepRTB.Font, MyItemInfo.MyContent.Text, true);
//ItemWidth = MyFlexGrid.Width; //ItemWidth = MyFlexGrid.Width;
//ItemLocation = new Point(50, _MyParentEditItem.Bottom); //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); Point newLocation = TableLocation(_MyParentEditItem, MyStepSectionLayoutData, ItemWidth);
if (!newLocation.Equals(ItemLocation)) ItemLocation = newLocation; if (!newLocation.Equals(ItemLocation)) ItemLocation = newLocation;
} }