Git Product home page Git Product logo

Comments (4)

BDisp avatar BDisp commented on July 20, 2024 1

I was able to change between windows using Ctrl + Tab, the problem was only when the mouse passed over the console after the first launch, which is the bug I described

I know that through the keyboard you can switch between windows, but the bug was due to an improper focus in the Application.Begin method and the CanFocus property. Please test with PR #3548 and check if it is working properly. Thanks.

from terminal.gui.

BDisp avatar BDisp commented on July 20, 2024

Thank you for presenting this issue. From what I noticed there is a contradiction in how views are drawn and how views are focused.
The FocusFirst instruction is trying to focus on the first focusable view but the drawing is drawing the last visible view which will be overlapped. It turns out that the most focused view does not correspond to the focused superview and this is incorrect.

from terminal.gui.

BDisp avatar BDisp commented on July 20, 2024

I changed the code to allowing toggling between windows.

        Application.Init ();

        var top = new Toplevel ();

        foreach (var arg in new [] { "1", "2" })
        {
            var win = new Window ()
            {
                Title = arg,
            };

            var editor = new TextView ()
            {
                Width = Dim.Fill (),
                Height = Dim.Fill (),
                Text = arg
            };

            win.Add (editor);

            top.Add (win);
        }

        MenuItem mi = null;
        View focused = null;

        var menuBar = new MenuBar
        {
            Menus =
            [
                new()
                {
                    Title = "Foo",
                    Children =
                    [
                        mi = new()
                        {
                            Title = "Set win 1 CanFocus to false",
                            Action = () =>
                                     {
                                         if (top.Focused.Title == "1")
                                         {
                                             if (focused is null)
                                             {
                                                 focused = top.Focused;
                                             }
                                             else if (focused != top.Focused)
                                             {
                                                 focused.CanFocus = true;
                                                 focused = top.Focused;
                                             }

                                             focused.CanFocus = false;
                                             mi.Title = "Set win 2 CanFocus to false";
                                         }
                                         else
                                         {
                                             focused.CanFocus = true;
                                             focused = top.Focused;
                                             focused.CanFocus = false;
                                             mi.Title = "Set win 1 CanFocus to false";
                                         }
                                     }
                        },
                    ]
                },
            ],
        };

        top.Add (menuBar);
        Application.Run (top);
        top.Dispose ();
        Application.Shutdown ();

from terminal.gui.

luizfernandonb avatar luizfernandonb commented on July 20, 2024

I changed the code to allowing toggling between windows.

I was able to change between windows using Ctrl + Tab, the problem was only when the mouse passed over the console after the first launch, which is the bug I described

from terminal.gui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.