From aa1af73cd6cefed90c3657b6a0a159ec8e06170e Mon Sep 17 00:00:00 2001 From: John Date: Thu, 7 Sep 2017 13:06:30 +0000 Subject: [PATCH] B2017-194 Added a NULL reference check before setting the enabled flag for the table border and align text buttons. MyFlexGrid was null when you moved off the table while in the adjust size mode. --- PROMS/Volian.Controls.Library/StepTabRibbon.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index cf67db8e..7c9f9bd7 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -709,11 +709,11 @@ namespace Volian.Controls.Library void MyFlexGrid_SelChange(object sender, EventArgs e) { + if (MyFlexGrid == null) + return; //B2017-156 Don't allow alignment or borders if the selection is not valid // Alternatively allow alignment or borders if the selection is valid rbTblBorder.Enabled = btnTblDgnAlignText.Enabled = MyFlexGrid.Selection.IsValid; - if (MyFlexGrid == null) - return; if (MyFlexGrid.Selection.c1 < 0 || MyFlexGrid.Selection.r1 < 0) return; if (MyFlexGrid.Selection.c1 >= MyFlexGrid.Cols.Count || MyFlexGrid.Selection.r1 >= MyFlexGrid.Rows.Count) @@ -3837,9 +3837,12 @@ namespace Volian.Controls.Library public void ToggleTableDesignButtons(bool enable) { bool enableContent = enable; - if (MyFlexGrid != null && MyFlexGrid.IsRoTable) enableContent = false; - //B2017-156 Don't allow alignment or borders if the selection is not valid - rbTblBorder.Enabled = btnTblDgnAlignText.Enabled = MyFlexGrid.Selection.IsValid && enable; + if (MyFlexGrid != null) + { + if (MyFlexGrid.IsRoTable) enableContent = false; + //B2017-156 Don't allow alignment or borders if the selection is not valid + rbTblBorder.Enabled = btnTblDgnAlignText.Enabled = MyFlexGrid.Selection.IsValid && enable; // B2017-194 moved to inside the test for a null MyFlexGrid + } btnTblDgnCopy.Enabled = enableContent; btnTblDgnRemove.Enabled = enableContent; btnCmGridInsert.Enabled = enableContent;