This commit is contained in:
John Jenko 2011-03-28 18:13:29 +00:00
parent 17a27bb8e8
commit 7f22d62f00
4 changed files with 21 additions and 12 deletions

View File

@ -537,7 +537,8 @@ namespace Volian.Controls.Library
{
Focus();
MyFlexGrid.Focus();
MyFlexGrid.Select(0, 0);
if (!MyFlexGrid.IsRoTable) // Table ROs are none editable - don't select a table cell
MyFlexGrid.Select(0, 0);
}
else
{
@ -576,10 +577,13 @@ namespace Volian.Controls.Library
int sl = MyStepRTB.SelectionLength;
MyFlexGrid.StartEditing();
MyStepRTB.Select(ss, sl); // need to reset selection because startediting positions to end.
string oldRtf = MyStepRTB.Rtf;
DialogResult dr = MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg);
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr;
if (!MyStepRTB.ReadOnly)
{
string oldRtf = MyStepRTB.Rtf;
DialogResult dr = MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg);
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr;
}
}
c = c + 1;
if (c == w)
@ -605,10 +609,13 @@ namespace Volian.Controls.Library
int sl = MyStepRTB.SelectionLength;
MyFlexGrid.StartEditing();
MyStepRTB.Select(ss, sl);
string oldRtf = MyStepRTB.Rtf;
DialogResult dr = MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg);
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr;
if (!MyStepRTB.ReadOnly)
{
string oldRtf = MyStepRTB.Rtf;
DialogResult dr = MyStepRTB.ReplaceText(rpltxt, fndstr, caseSensitive, matchWholeWord, reverse, prompt, fndrpldlg);
if (oldRtf != MyStepRTB.Rtf) MyFlexGrid[r, c] = MyStepRTB.Rtf;
if (dr == DialogResult.Yes || dr == DialogResult.Cancel) return dr;
}
}
c = c - 1;
if (c < 0)

View File

@ -86,7 +86,8 @@ namespace Volian.Controls.Library
grd.SetSearchCell(SearchString);
}
// convert the '-' to the unicode non-breaking dash (\u8209? or \u2011 hex)
SelectedEditItem.MyStepRTB.Find(SearchString.Replace('-','\u2011'));
if (!SelectedEditItem.MyStepRTB.IsRoTable)
SelectedEditItem.MyStepRTB.Find(SearchString.Replace('-','\u2011'));
}
#endregion
#region Contructors

View File

@ -1828,7 +1828,7 @@ namespace Volian.Controls.Library
public void SetRibbonForGrid()
{
// set to true if editing cell, otherwise false for grids
bool enable = (MyFlexGrid.Editor != null);
bool enable = (MyFlexGrid != null && MyFlexGrid.Editor != null);
btnPaste.Enabled = enable;
btnCopy.Enabled = enable;
btnCut.Enabled = enable;

View File

@ -3827,6 +3827,7 @@ namespace Volian.Controls.Library
public void StartEditing(int row, int col)
{
_initializingEdit = true;
ReadOnly = IsRoTable;
// save coordinates of cell being edited
_row = row;
_col = col;
@ -3841,7 +3842,7 @@ namespace Volian.Controls.Library
// initialize control content
Text = "";
FindAllLinks(); // jsj 1-5-2011
if (_pendingKey > ' ')
if (_pendingKey > ' ' && !ReadOnly)
Text = _pendingKey.ToString();
else if (_owner[row, col] != null)
{