Browse Source

Merge branch 'master' into crlf_label

Charlie Kindel 5 years ago
parent
commit
606e2728ae
2 changed files with 10 additions and 7 deletions
  1. 9 7
      Example/demo.cs
  2. 1 0
      README.md

+ 9 - 7
Example/demo.cs

@@ -235,14 +235,14 @@ static class Demo {
 	}
 
 	//
-	// Creates a nested editor
-	static void Editor (Toplevel top)
+	static void Editor ()
 	{
-		var tframe = top.Frame;
-		var ntop = new Toplevel (tframe);
+		var tframe = Application.Top.Frame;
+		Application.Top.RemoveAll ();
+		var ntop = Application.Top;
 		var menu = new MenuBar (new MenuBarItem [] {
 			new MenuBarItem ("_File", new MenuItem [] {
-				new MenuItem ("_Close", "", () => {Application.RequestStop ();}),
+				new MenuItem ("_Close", "", () => { if (Quit ()) {Application.RequestStop (); } }),
 			}),
 			new MenuBarItem ("_Edit", new MenuItem [] {
 				new MenuItem ("_Copy", "", null),
@@ -273,7 +273,9 @@ static class Demo {
 			text.Text = System.IO.File.ReadAllText (fname);
 		win.Add (text);
 
-		Application.Run (ntop);
+		Application.Run (ntop, false);
+		Application.Top.RemoveAll ();
+		Main ();
 	}
 
 	static bool Quit ()
@@ -576,7 +578,7 @@ static class Demo {
 
 		menu = new MenuBar (new MenuBarItem [] {
 			new MenuBarItem ("_File", new MenuItem [] {
-				new MenuItem ("Text _Editor Demo", "", () => { Editor (top); }),
+				new MenuItem ("Text _Editor Demo", "", () => { Editor (); }),
 				new MenuItem ("_New", "Creates new file", NewFile),
 				new MenuItem ("_Open", "", Open),
 				new MenuItem ("_Hex", "", () => ShowHex (top)),

+ 1 - 0
README.md

@@ -1,4 +1,5 @@
 ![.NET Core](https://github.com/migueldeicaza/gui.cs/workflows/.NET%20Core/badge.svg?branch=master)
+![Code scanning - action](https://github.com/migueldeicaza/gui.cs/workflows/Code%20scanning%20-%20action/badge.svg)
 [![Version](https://img.shields.io/nuget/v/Terminal.Gui.svg)](https://www.nuget.org/packages/Terminal.Gui)
 [![Downloads](https://img.shields.io/nuget/dt/Terminal.Gui)](https://www.nuget.org/packages/Terminal.Gui)
 [![License](https://img.shields.io/github/license/migueldeicaza/gui.cs.svg)](LICENSE)