mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
* key down/up support * line endings? * line endings * KeyDown/Up support * line endings * line endings * Revert "Drop NuGet restore" This reverts commit5c7a0d05f0. * Revert "Revert "Drop NuGet restore"" This reverts commit2dc5fce865. * updated demo * defined styles * Smarter StatusBar bottom tracking. * Prepping for https://github.com/migueldeicaza/gui.cs/issues/376 * Oops. * Fixed StatusBar 'snap to bottom' * line endings * Revert "Fixed StatusBar 'snap to bottom'" This reverts commit9a91c957e2. * started UICatalog project * Initial working POC. * Fix newlines * merge * textalignment demo tweaks * textalignment demo tweaks * Unicode Menu Scenario * not sure why this keeps changing * re-added project to .sln file * re-enabled status bar * moved scenarios to dir * building a dim and pos demo * terminal.sln * progress...barely * fixed exit * progress with some underlying fixes to Label * added readme * fixes build issue * launch * made default colors readable on Windows * major UI Catalog upgrade * added more demos and updated readme * refactored and added more tests * added ref to Issue #437 * added OnKeyUp support to Curses and Net drivers * more tweaks - grab PR #438 first * Added a OpenSelectedItem event to the ListView #429 * updates * moved KeyUpHandler out of special ESC stuff * more tweaks & improvements * testing top window bug * supported OpenSelectedItem * lots of updates * fixed regression, fixed #444 * better button scenario * tweaks * add Ready event to Toplevel * dotfx .gitignroe * ready for ready * updated colors based on feedback; consolodated config code * tweaked readme * readme * Added Editor demonstrating TextView * Added Editor demonstrating TextView * added hexeditor scenario Co-authored-by: Miguel de Icaza <miguel@gnome.org> Co-authored-by: BDisp <bd.bdisp@gmail.com>
106 lines
2.9 KiB
C#
106 lines
2.9 KiB
C#
using Terminal.Gui;
|
|
|
|
namespace UICatalog {
|
|
[ScenarioMetadata (Name: "Buttons", Description: "Demonstrates all sorts of Buttons")]
|
|
[ScenarioCategory ("Controls")]
|
|
[ScenarioCategory ("Layout")]
|
|
class Buttons : Scenario {
|
|
public override void Setup ()
|
|
{
|
|
// Add a label & text field so we can demo IsDefault
|
|
var editLabel = new Label ("TextField (to demo IsDefault):") {
|
|
X = 0,
|
|
Y = 0,
|
|
};
|
|
Win.Add (editLabel);
|
|
var edit = new TextField ("") {
|
|
X = Pos.Right (editLabel) + 1,
|
|
Y = Pos.Top (editLabel),
|
|
Width = Dim.Fill (2),
|
|
};
|
|
Win.Add (edit);
|
|
|
|
// This is the default button (IsDefault = true); if user presses ENTER in the TextField
|
|
// the scenario will quit
|
|
var defaultButton = new Button ("Quit") {
|
|
X = Pos.Center (),
|
|
// BUGBUG: Throws an exception
|
|
//Y= Pos.Bottom(Win),
|
|
Y = 20,
|
|
IsDefault = true,
|
|
Clicked = () => Application.RequestStop (),
|
|
};
|
|
Win.Add (defaultButton);
|
|
|
|
var y = 2;
|
|
var button = new Button (10, y, "Base Color") {
|
|
ColorScheme = Colors.Base,
|
|
Clicked = () => MessageBox.Query (30, 7, "Message", "Question?", "Yes", "No")
|
|
};
|
|
Win.Add (button);
|
|
|
|
y += 2;
|
|
Win.Add (new Button (10, y, "Error Color") {
|
|
ColorScheme = Colors.Error,
|
|
Clicked = () => MessageBox.Query (30, 7, "Message", "Question?", "Yes", "No")
|
|
});
|
|
|
|
y += 2;
|
|
Win.Add (new Button (10, y, "Dialog Color") {
|
|
ColorScheme = Colors.Dialog,
|
|
Clicked = () => MessageBox.Query (30, 7, "Message", "Question?", "Yes", "No")
|
|
});
|
|
|
|
y += 2;
|
|
Win.Add (new Button (10, y, "Menu Color") {
|
|
ColorScheme = Colors.Menu,
|
|
Clicked = () => MessageBox.Query (30, 7, "Message", "Question?", "Yes", "No")
|
|
});
|
|
|
|
y += 2;
|
|
Win.Add (new Button (10, y, "TopLevel Color") {
|
|
ColorScheme = Colors.TopLevel,
|
|
Clicked = () => MessageBox.Query (30, 7, "Message", "Question?", "Yes", "No")
|
|
});
|
|
|
|
y += 2;
|
|
Win.Add (new Button (10, y, "A super long button that will probably expose a bug in clipping or wrapping of text. Will it?") {
|
|
Clicked = () => MessageBox.Query (30, 7, "Message", "Question?", "Yes", "No")
|
|
});
|
|
|
|
y += 2;
|
|
// Note the 'N' in 'Newline' will be the hotkey
|
|
Win.Add (new Button (10, y, "a Newline\nin the button") {
|
|
Clicked = () => MessageBox.Query (30, 7, "Message", "Question?", "Yes", "No")
|
|
});
|
|
|
|
y += 2;
|
|
// BUGBUG: Buttons don't support specifying hotkeys with _?!?
|
|
Win.Add (button = new Button (10, y, "Te_xt Changer") {
|
|
});
|
|
button.Clicked = () => button.Text += $"{y++}";
|
|
|
|
Win.Add (new Button ("Lets see if this will move as \"Text Changer\" grows") {
|
|
X = Pos.Right(button) + 10,
|
|
Y = y,
|
|
});
|
|
|
|
y += 2;
|
|
Win.Add (new Button (10, y, "Delete") {
|
|
ColorScheme = Colors.Error,
|
|
Clicked = () => Win.Remove (button)
|
|
});
|
|
|
|
y += 2;
|
|
Win.Add (new Button (10, y, "Change Default") {
|
|
Clicked = () => {
|
|
defaultButton.IsDefault = !defaultButton.IsDefault;
|
|
button.IsDefault = !button.IsDefault;
|
|
},
|
|
});
|
|
|
|
|
|
}
|
|
}
|
|
}
|