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.

This commit is contained in:
John Jenko 2017-09-07 13:06:30 +00:00
parent f5f1cb32ee
commit aa1af73cd6

View File

@ -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;