working entry dialogue made with the help of practically nonexistent documentation
This commit is contained in:
parent
d6bf37da44
commit
aef8ef0bbd
1 changed files with 23 additions and 0 deletions
|
@ -15,10 +15,33 @@ namespace Buypeeb {
|
||||||
Application.Quit();
|
Application.Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convenience functions
|
||||||
|
|
||||||
|
private (Boolean accepted, string response) EntryDialogue(string title = "Buypeeb", string message = "Hi there!") {
|
||||||
|
Dialog ed = new Dialog(title, null, Gtk.DialogFlags.DestroyWithParent, "Cancel", ResponseType.Cancel, "OK", ResponseType.Ok);
|
||||||
|
|
||||||
|
Label edLabel = new Label(message);
|
||||||
|
Entry edEntry = new Entry();
|
||||||
|
|
||||||
|
ed.ContentArea.PackStart(edLabel, true, true, 2);
|
||||||
|
edLabel.Show();
|
||||||
|
ed.ContentArea.PackStart(edEntry, true, true, 10);
|
||||||
|
edEntry.Show();
|
||||||
|
|
||||||
|
// TODO: pressing enter should submit the form
|
||||||
|
|
||||||
|
ResponseType accepted = (ResponseType)ed.Run();
|
||||||
|
string response = edEntry.Text;
|
||||||
|
ed.Destroy();
|
||||||
|
return (accepted == ResponseType.Ok, response);
|
||||||
|
}
|
||||||
|
|
||||||
// button handlers
|
// button handlers
|
||||||
|
|
||||||
private void ButtonAddClicked(object sender, EventArgs a) {
|
private void ButtonAddClicked(object sender, EventArgs a) {
|
||||||
Console.WriteLine("ButtonAddClicked");
|
Console.WriteLine("ButtonAddClicked");
|
||||||
|
var EntryResponse = EntryDialogue();
|
||||||
|
Console.WriteLine(EntryResponse.response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonUpdateAllClicked(object sender, EventArgs a) {
|
private void ButtonUpdateAllClicked(object sender, EventArgs a) {
|
||||||
|
|
Loading…
Reference in a new issue