mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixed a moving window issue. Added OnLoad Action because there are settings that need to be accessed only once. (#375)
* Fixed a moving window issue. Added OnLoad Action because there are settings that need to be accessed only once. * Fixes a layout issue that does not updated the Pos outside the bounds. * Fixes a issue with other top-levels. Co-authored-by: Miguel de Icaza <miguel@gnome.org>
This commit is contained in:
@@ -446,7 +446,6 @@ static class Demo {
|
||||
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo ("en-US");
|
||||
|
||||
//Application.UseSystemConsole = true;
|
||||
Console.WindowHeight = 35;
|
||||
|
||||
Application.Init ();
|
||||
|
||||
@@ -454,11 +453,13 @@ static class Demo {
|
||||
|
||||
//Open ();
|
||||
#if true
|
||||
int margin = 3;
|
||||
var win = new Window ("Hello") {
|
||||
X = 1,
|
||||
Y = 1,
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill () - 1
|
||||
|
||||
Width = Dim.Fill () - margin,
|
||||
Height = Dim.Fill () - margin
|
||||
};
|
||||
#else
|
||||
var tframe = top.Frame;
|
||||
@@ -528,7 +529,7 @@ static class Demo {
|
||||
ShowEntries (win);
|
||||
|
||||
int count = 0;
|
||||
ml = new Label (new Rect (3, 18, 47, 1), "Mouse: ");
|
||||
ml = new Label (new Rect (3, 17, 47, 1), "Mouse: ");
|
||||
Application.RootMouseEvent += delegate (MouseEvent me) {
|
||||
ml.TextColor = Colors.TopLevel.Normal;
|
||||
ml.Text = $"Mouse: ({me.X},{me.Y}) - {me.Flags} {count++}";
|
||||
@@ -554,21 +555,24 @@ static class Demo {
|
||||
|
||||
win.Add (drag, dragText);
|
||||
#if true
|
||||
// This currently causes a stack overflow, because it is referencing a window that has not had its size allocated yet
|
||||
// FIXED: This currently causes a stack overflow, because it is referencing a window that has not had its size allocated yet
|
||||
|
||||
var bottom = new Label ("This should go on the bottom!");
|
||||
var bottom = new Label ("This should go on the bottom of the same top-level!");
|
||||
win.Add (bottom);
|
||||
var bottom2 = new Label ("This should go on the bottom of another top-level!");
|
||||
top.Add (bottom2);
|
||||
|
||||
Application.OnResized = () => {
|
||||
bottom.X = Pos.Left (win);
|
||||
bottom.Y = Pos.Bottom (win);
|
||||
Application.OnLoad = () => {
|
||||
bottom.X = win.X;
|
||||
bottom.Y = Pos.Bottom (win) - Pos.Top (win) - margin;
|
||||
bottom2.X = Pos.Left (win);
|
||||
bottom2.Y = Pos.Bottom (win);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
top.Add (win);
|
||||
//top.Add (menu);
|
||||
top.Add (menu, statusBar, ml);
|
||||
top.Add (menu, statusBar);
|
||||
Application.Run ();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user