diff --git a/PROMS/Volian.Controls.Library/GridItem.cs b/PROMS/Volian.Controls.Library/GridItem.cs index 6c468882..3dc169bd 100644 --- a/PROMS/Volian.Controls.Library/GridItem.cs +++ b/PROMS/Volian.Controls.Library/GridItem.cs @@ -15,21 +15,6 @@ namespace Volian.Controls.Library { public partial class GridItem : EditItem { - /* - * TODO: (2/16/11) - * 1) KBR Need to include/handle StepRTB/EditItem Events: Add for grid items, the events that - * are handled by StepRTB/EditItem. Should these be abstract events within EditItem so - * that it 'tells' you which events you need. - * May Need yet: - * OnOpenContextMenu (grid and/or rtb) - * OnSetMenu?? - related to context menu - * 2) KBR ContextMenu for table. May want it to function in a similar way to spellcheck, with - * the contentmenu to support table options and a last item that supports existing - * contextmenu - * 3) When data migration of tables, need to include the font if there is a symbol. Move - * AddFontTable from StepRTB.cs to a place accessible, such as volian.base. And then - * in data migration, will need to know if a font is fixed. - */ #region Fields public VlnFlexGrid MyFlexGrid { @@ -172,18 +157,10 @@ namespace Volian.Controls.Library } void MyStepRTB_DoSaveContents(object sender, EventArgs args) { - if (MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0) // Only if a Cell is Selected - { - int row = MyFlexGrid.Row; - int col = MyFlexGrid.Col; - SaveContents(); - MyStepRTB.Rtf = MyStepRTB.DoNewLinkInGridCell(); - MyFlexGrid.Row = row; - MyFlexGrid.Col = col; - MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col] = MyStepRTB.Rtf; - } - SaveContents(); + SaveCurrentAndContents(); } + + void MyStepRTB_VisibleChanged(object sender, EventArgs e) { MyStepRTB.EditMode = MyStepRTB.Visible; @@ -205,6 +182,7 @@ namespace Volian.Controls.Library private void AdjustColorsForEditMode() { + MyFlexGrid.StyleBackColor = Color.White; if (MyStepRTB.EditMode) { MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Focus"].BackColor = @@ -503,6 +481,7 @@ namespace Volian.Controls.Library // in the grid: MyFlexGrid.Cols.Fixed = 0; MyFlexGrid.Rows.Fixed = 0; + MyFlexGrid.StyleBackColor = Color.White; string xml = MyFlexGrid.GetXMLData(); using (Item itm = MyItemInfo.Get()) @@ -763,15 +742,7 @@ namespace Volian.Controls.Library { if (highlight) { - //for (int r = 0; r < MyFlexGrid.Rows.Count; r++) - // for (int c = 0; c < MyFlexGrid.Cols.Count; c++) - // { - // CellStyle cs = MyFlexGrid.GetCellStyle(r, c); - // CellRange cr = MyFlexGrid.GetCellRange(r, c); - // Console.WriteLine("Style[{0},{1}] = '{2}' {3} '{4}'", r,c,cs.Name,cs.BackColor,cr.StyleNew.Name); - // } - MyFlexGrid.Styles["Alternate"].BackColor = - MyFlexGrid.Styles["Normal"].BackColor = Color.Gray; + MyFlexGrid.StyleBackColor = Color.Gray; } else { @@ -779,8 +750,7 @@ namespace Volian.Controls.Library SetActive(); else // Otherwise Set the BackColor to either the InactiveColor or the AnnotationColor { - MyFlexGrid.Styles["Alternate"].BackColor = - MyFlexGrid.Styles["Normal"].BackColor = + MyFlexGrid.StyleBackColor = MyItemInfo.ItemAnnotationCount == 0 ? MyStepPanel.InactiveColor : MyStepPanel.AnnotationColor; // Turn-off Size adjustment MyFlexGrid.Cols.Fixed = 0; @@ -807,6 +777,7 @@ namespace Volian.Controls.Library MyFlexGrid.Clear(); MyFlexGrid.MergedRanges.Clear(); MyFlexGrid.ReadXml(xd); + MyFlexGrid.KeyActionTab = KeyActionEnum.MoveAcross; MyFlexGrid.AdjustGridControlSize(); // When a grid is read from XML, all of the styles are updated to the values in the XML. // Thus any specific settings need to be set after the grid is read. @@ -854,6 +825,20 @@ namespace Volian.Controls.Library SaveContents(); } public override void SetExpandAndExpander(ItemInfo itemInfo) { CanExpand = false; } // can't expand a table + public override void SaveCurrentAndContents() + { + if (MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0) // Only if a Cell is Selected + { + int row = MyFlexGrid.Row; + int col = MyFlexGrid.Col; + SaveContents(); + MyStepRTB.Rtf = MyStepRTB.DoNewLinkInGridCell(); + MyFlexGrid.Row = row; + MyFlexGrid.Col = col; + MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col] = MyStepRTB.Rtf; + } + SaveContents(); + } #endregion #region Miscellaneous Support internal void SetSearchCell(string SearchString)