You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.5 KiB
70 lines
1.5 KiB
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace NoteMan
|
|
{
|
|
public partial class TextInput : Form
|
|
{
|
|
private string _returnValue;
|
|
public TextInput()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public new string Show()
|
|
{
|
|
return Show("Name?", "");
|
|
}
|
|
|
|
public new string ShowDialog()
|
|
{
|
|
return Show("Name?", "");
|
|
}
|
|
|
|
public string Show(string label)
|
|
{
|
|
return Show(label, "");
|
|
}
|
|
|
|
public string ShowDialog(string label)
|
|
{
|
|
return Show(label, "");
|
|
}
|
|
|
|
public string ShowDialog(string label, string value)
|
|
{
|
|
return Show(label, value);
|
|
}
|
|
|
|
public string Show(string label, string value)
|
|
{
|
|
_returnValue = null;
|
|
txtInput.Text = "";
|
|
label1.Text = label;
|
|
txtInput.Text = value;
|
|
base.ShowDialog();
|
|
return _returnValue;
|
|
}
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
_returnValue = txtInput.Text;
|
|
Close();
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void txtInput_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if (e.KeyChar == (char) 13)
|
|
{
|
|
_returnValue = txtInput.Text;
|
|
Close();
|
|
}
|
|
}
|
|
}
|
|
}
|