Skip to content

Commit

Permalink
F2 / keystroke initiated editbox text editing undo/redo. Issue #18.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliftonm committed Nov 10, 2016
1 parent f9e1406 commit 59012fe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions FlowSharpLib/ExtensionMethods.cs
Expand Up @@ -340,6 +340,8 @@ public static void ChangePropertyWithUndoRedo<T>(this GraphicElement el, string
{
if (redo)
{
// TODO: If element is selected element (and only 1 selected element?) update property grid as well.
// Or simply select element undergoing undo/redo?
el.Canvas.Controller.Redraw(el, _ => piElement.SetValue(el, redosave));
}
else if (@do)
Expand All @@ -349,6 +351,8 @@ public static void ChangePropertyWithUndoRedo<T>(this GraphicElement el, string
}
else
{
// TODO: If element is selected element (and only 1 selected element?) update property grid as well.
// Or simply select element undergoing undo/redo?
el.Canvas.Controller.Redraw(el, _ => piElement.SetValue(el, save));
}
}, finishGroup);
Expand Down
6 changes: 3 additions & 3 deletions FlowSharpUI.cs
Expand Up @@ -332,9 +332,9 @@ protected void TerminateEditing()
shapeBeingEdited.ChangePropertyWithUndoRedo<string>("Text", editBox.Text);
shapeBeingEdited.Text = editBox.Text;
canvasController.Redraw(shapeBeingEdited);

canvas.Controls.Remove(editBox);
editBox = null;
TextBox tb = editBox;
editBox = null; // set editBox to null so the remove, which fires a LoseFocus event, doesn't call into TerminateEditing again!
canvas.Controls.Remove(tb);

// Updates PropertyGrid:
canvasController.ElementSelected.Fire(this, new ElementEventArgs() { Element = shapeBeingEdited });
Expand Down

0 comments on commit 59012fe

Please sign in to comment.