fixed use of Insert Symbol into a table cell and fixed bug where you could not select /copy a portion of table cell text

This commit is contained in:
John Jenko 2012-07-16 15:09:47 +00:00
parent 7bcfafcc8b
commit d13a0f0fb5

View File

@ -947,6 +947,15 @@ namespace Volian.Controls.Library
/// <param name="selectAll">If false cursor will be placed at the begining</param> /// <param name="selectAll">If false cursor will be placed at the begining</param>
private void StartGridEditing(SelectionOption selOpt) private void StartGridEditing(SelectionOption selOpt)
{ {
// Bug fix: B2012-203, B2012-204
// Need to check if the selected table cell is in edit mode already.
// if already in edit mode, we don't want to do the StartEditing code below, because it
// will override the current cursor positioning and selection range.
Control ctrl = FindActiveControl();
if (ctrl is VlnFlexGrid)
{
// Selected table cell is not in edit mode. Go into edit mode and position acording
// to the pass in selOpt.
if (MyFlexGrid != null && MyFlexGrid.Editor == null) if (MyFlexGrid != null && MyFlexGrid.Editor == null)
{ {
MyFlexGrid.StartEditing(); MyFlexGrid.StartEditing();
@ -966,7 +975,7 @@ namespace Volian.Controls.Library
break; break;
} }
} }
}
} }
public void btnInsPgBrk_Click(object sender, EventArgs e) public void btnInsPgBrk_Click(object sender, EventArgs e)
{ {
@ -1050,18 +1059,25 @@ namespace Volian.Controls.Library
} }
private Control FindActiveControl() private Control FindActiveControl()
{ {
// added the flag below because a table (grid) could have a cell selected (a control)
// but it might not have focus (in edit mode)
bool beenThereDoneThat = false; // flag to prevent infinate loop
Control tmp = this; Control tmp = this;
while (!(tmp.Parent is Form)) while (!(tmp.Parent is Form))
tmp = tmp.Parent; tmp = tmp.Parent;
Form frm = tmp.Parent as Form; Form frm = tmp.Parent as Form;
tmp = frm.ActiveControl; tmp = frm.ActiveControl;
while (tmp.Controls.Count > 0) while (!beenThereDoneThat && tmp.Controls.Count > 0)
{
beenThereDoneThat = true;
foreach (Control ctrl in tmp.Controls) foreach (Control ctrl in tmp.Controls)
if (ctrl.ContainsFocus) if (ctrl.ContainsFocus)
{ {
tmp = ctrl; tmp = ctrl;
beenThereDoneThat = false;
break; break;
} }
}
return tmp; return tmp;
} }
private void btnCut_Click(object sender, EventArgs e) private void btnCut_Click(object sender, EventArgs e)