Exemple #1
0
    static void ShowEntries(View container)
    {
        var scrollView = new ScrollView(new Rect(50, 10, 20, 8))
        {
            ContentSize = new Size(20, 50),
            //ContentOffset = new Point (0, 0),
            ShowVerticalScrollIndicator   = true,
            ShowHorizontalScrollIndicator = true
        };

#if false
        scrollView.Add(new Box10x(0, 0));
#else
        var filler = new Filler(new Rect(0, 0, 40, 40));
        scrollView.Add(filler);
        scrollView.DrawContent = (r) => {
            scrollView.ContentSize = filler.GetContentSize();
        };
#endif

        // This is just to debug the visuals of the scrollview when small
        var scrollView2 = new ScrollView(new Rect(72, 10, 3, 3))
        {
            ContentSize = new Size(100, 100),
            ShowVerticalScrollIndicator   = true,
            ShowHorizontalScrollIndicator = true
        };
        scrollView2.Add(new Box10x(0, 0));
        var progress = new ProgressBar(new Rect(68, 1, 10, 1));
        bool timer(MainLoop caller)
        {
            progress.Pulse();
            return(true);
        }

        Application.MainLoop.AddTimeout(TimeSpan.FromMilliseconds(300), timer);


        // A little convoluted, this is because I am using this to test the
        // layout based on referencing elements of another view:

        var login = new Label("Login: "******"Password: "******"")
        {
            X     = Pos.Right(password),
            Y     = Pos.Top(login),
            Width = 40
        };

        var passText = new TextField("")
        {
            Secret = true,
            X      = Pos.Left(loginText),
            Y      = Pos.Top(password),
            Width  = Dim.Width(loginText)
        };

        var tf = new Button(3, 19, "Ok");
        // Add some content
        container.Add(
            login,
            loginText,
            password,
            passText,
            new FrameView(new Rect(3, 10, 25, 6), "Options")
        {
            new CheckBox(1, 0, "Remember me"),
            new RadioGroup(1, 2, new ustring [] { "_Personal", "_Company" }),
        },
            new ListView(new Rect(59, 6, 16, 4), new string [] {
            "First row",
            "<>",
            "This is a very long row that should overflow what is shown",
            "4th",
            "There is an empty slot on the second row",
            "Whoa",
            "This is so cool"
        }),
            scrollView,
            scrollView2,
            tf,
            new Button(10, 19, "Cancel"),
            new TimeField(3, 20, DateTime.Now.TimeOfDay),
            new TimeField(23, 20, DateTime.Now.TimeOfDay, true),
            new DateField(3, 22, DateTime.Now),
            new DateField(23, 22, DateTime.Now, true),
            progress,
            new Label(3, 24, "Press F9 (on Unix, ESC+9 is an alias) or Ctrl+T to activate the menubar"),
            menuKeysStyle,
            menuAutoMouseNav

            );
        container.SendSubviewToBack(tf);
    }