Index: src/Common/DelftTools.Controls.Swf/InputTextDialog.cs
===================================================================
diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a
--- src/Common/DelftTools.Controls.Swf/InputTextDialog.cs (.../InputTextDialog.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9)
+++ src/Common/DelftTools.Controls.Swf/InputTextDialog.cs (.../InputTextDialog.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a)
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
using System.Windows.Forms;
namespace DelftTools.Controls.Swf
@@ -7,30 +8,63 @@
/// Simple input box dialog
///
public partial class InputTextDialog : Form
- {
+ {
+ private bool escapeButtonPressed;
+
public InputTextDialog()
{
InitializeComponent();
InitialText = "";
- textBox1.Validating += textBox1_Validating;
+ textBox1.Validating += textBox1_Validating;
errorProvider.SetIconAlignment(ButtonOk, ErrorIconAlignment.MiddleLeft);
ValidationErrorMsg = "Please verify the input is valid";
}
- private bool escapeButtonPressed;
-
public bool Multiline
{
- get { return textBox1.Multiline; }
+ get
+ {
+ return textBox1.Multiline;
+ }
set
{
textBox1.Multiline = value;
AcceptButton = value ? null : ButtonOk;
}
}
- void textBox1_Validating(object sender, System.ComponentModel.CancelEventArgs e)
+ ///
+ /// Text the user entered in the dialog
+ ///
+ public string EnteredText
{
+ get
+ {
+ return textBox1.Text;
+ }
+ set
+ {
+ textBox1.Text = value;
+ }
+ }
+
+ public string InitialText { get; set; }
+
+ public Predicate ValidationMethod { get; set; }
+
+ public string ValidationErrorMsg { get; set; }
+
+ protected override bool ProcessDialogKey(Keys keyData)
+ {
+ if (keyData == Keys.Escape)
+ {
+ escapeButtonPressed = true;
+ }
+ return base.ProcessDialogKey(keyData);
+ }
+
+ private void textBox1_Validating(object sender, CancelEventArgs e)
+ {
if (escapeButtonPressed)
{
// no validation on cancel
@@ -70,32 +104,11 @@
DialogResult = DialogResult.Cancel;
}
- protected override bool ProcessDialogKey(Keys keyData)
- {
- if (keyData == Keys.Escape) escapeButtonPressed = true;
- return base.ProcessDialogKey(keyData);
- }
-
- ///
- /// Text the user entered in the dialog
- ///
- public string EnteredText
- {
- get { return textBox1.Text; }
- set { textBox1.Text = value; }
- }
-
- public string InitialText { get; set; }
-
- public Predicate ValidationMethod { get; set; }
-
- public string ValidationErrorMsg { get; set; }
-
private void InputTextDialogActivated(object sender, EventArgs e)
{
//set focus to the textbox when the dialog is shown
textBox1.Text = InitialText;
textBox1.Focus();
}
}
-}
+}
\ No newline at end of file