Git Product home page Git Product logo

Comments (3)

tznind avatar tznind commented on July 20, 2024 1

Hmn, I don't think Text should be the place for this. It looks like a string but it behaves like a method.

In general I think properties are not the place for non deterministic behaviours.

Consider the following example:

    [Test]
    public void TestTextSliderString()
    {
        var s1 = new Slider<string>();
        var s2 = new Slider<string>();
        s2.Text = "I've got a lovely bunch of coconuts, here they are sitting in a row!";
     
        // This line does not do what it looks like
        s1.Text = s2.Text;

        TestContext.Out.WriteLine("Options:" + s1.Options.Count); //2
        TestContext.Out.WriteLine("Options:" + s2.Options.Count); //6!

        ClassicAssert.IsTrue(s1.Options.Count == s2.Options.Count );
    }

from terminal.gui.

BDisp avatar BDisp commented on July 20, 2024 1

I think the Text and Title properties should be independent and have no relationship between them. By default, Text will be drawn inside the view, with the exception of custom drawing. The Title should only be used when a view has a border and is not an empty string.

Edit:
This exposition is just to warn you that in this case Options and Text should not have any relationship between them, with the exception that Text can be used to reflect the string that will be displayed relative to the currently selected Options.

from terminal.gui.

tig avatar tig commented on July 20, 2024

I wanted Slider to work in AllViewsTester so I made setting Text to a comma delimited string equivalent to setting Options.

Feel free to undo this, but I'd live ideas on how to make AllViewsTester support causing Views to be "useful/visible" without having custom logic per-view.

I did the same thing to RadioGroup.

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.