HISE Logo Forum
    • Categories
    • Register
    • Login

    Calculator Project

    Scheduled Pinned Locked Moved Scripting
    34 Posts 3 Posters 2.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Sawer @ustk
      last edited by

      @ustk Ahahah It's a challenging but cool project. I'm learning a lot!
      Thanks so much guys.

      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @Sawer
        last edited by

        @sawer said in Calculator Project:

        Do I also need to learn a bit of logics?

        This is absolutely the most important part of programming. Once you understand boolean logic, operators, and control statements (loops and ifs) then you'll be able to plan your strategy more quickly and efficiently.

        But I change things as I go too. For example in my calculator example I've used two different methods for adding the input to the label, but I think the second method (getting the button text) is actually better in this example and I should have used it for both.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        S 1 Reply Last reply Reply Quote 0
        • S
          Sawer @d.healey
          last edited by

          @d-healey said in Calculator Project:

          This is absolutely the most important part of programming.

          Thanks.
          How and where to learn logics? Wanna do that on a daily basis to be more proficient in thinking.

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Sawer
            last edited by

            @sawer said in Calculator Project:

            How and where to learn logics?

            There are some links to Javascript tutorials in the HISE docs which are a good place to start. Once you get the basics you need to read and write lots of code to practice and get it to become a natural part of your thinking when you're presented with a programming challenge.

            YouTube is also a good for general info - https://www.youtube.com/results?search_query=boolean+logic

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            S 1 Reply Last reply Reply Quote 0
            • S
              Sawer @d.healey
              last edited by

              @d-healey Thanks a lot!

              1 Reply Last reply Reply Quote 0
              • S
                Sawer
                last edited by Sawer

                HiseSnippet 1155.3ocsW1uahaDD.eMI9zg6Gpmz8.rG+EQIkCx2mRSaBjjJT9BURipTzoSarWBqhYWqcWmFTUj56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CBqmaU3p4.g0mFD1HWDXyABaLMHrYdHrGeNPXyoAgsxcufXNPXqoAgsyCg+NbNPX6oAgOj6Mhn4.gO7hQ.erXdHP0yABKCSY+rIHgYWUAwgL63CzhSwOPA7TpwlhDmTTZD19Ymx++sobeoH9F2VBqe2IyXgIvH7rruDLN3cC9F2CgQ57si.bQ2i9suLuH.4WTwVXrwSYVs.1n3BuCVa30i74vUWJ4g3TBNEvmmmJWEkwJPatLHQ3egOCTVCkcFnr1PkjdLes5S9oylfu8wqSVAXRl7hWEcOEko0HIyq.94VsRUROXi2m78wz+6gQLlrOqNC9r1L3y5yfOaLC9r4L3yVyfOa+Y8AOyuerU0K83.rPqCSFhyw4vjlBI6BI+GfQeWT2
                

                @d-healey @ustk Ehehe, I think Really tried my best. Probably the challenge is too big for me. This is how far I got and I don't really know how to break the problem into a smaller one..So I'm stuck.

                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @Sawer
                  last edited by

                  @sawer Add a label to display the output and add an = button that when pressed carries out the calculation.

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    Sawer @d.healey
                    last edited by

                    @d-healey Thanks.
                    Given some tome to try understanding your code:

                    1. How did you come up with he appendInput function , especially the "+="
                    2. What's eval? There's no this such as that in the Api.

                    I'm learning a lot. Thanks

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @Sawer
                      last edited by d.healey

                      @sawer said in Calculator Project:

                      How did you come up with he appendInput function , especially the "+="

                      += Is a standard js operator

                      @sawer said in Calculator Project:

                      What's eval? There's no this such as that in the Api.

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      S 1 Reply Last reply Reply Quote 0
                      • S
                        Sawer @d.healey
                        last edited by Sawer

                        @d-healey Thanks David.

                        So I realised that I'm trying to solve problems that are bigger than me. This project is bigger than me. I'm pausing it for now and and solve easier problems while getting more of the logical thinking. Once I get more experience on this, I'll come back with more knowledge and more confidence to solve.
                        Thanks a lot.

                        1 Reply Last reply Reply Quote 2
                        • S
                          Sawer
                          last edited by Sawer

                          Hello everyone!
                          I've finally managed to build the calculator with my own fingers and brain.
                          I understood the logics behind the operations and especially the input to the label component.

                          Screen Recording 2022-02-08 at 15.31.27.gif

                          I'm getting excited to improve it just a little bit, and by that I have 3 questions:

                          1. How can I use the operational button as "switches" where only on sign can be accepted by the input for each operation (23 +- 21, I do not want this to happen).

                          2. Is there a way to not "show" the operational sign to the label without affecting the input?

                          3. Is there a way to reset the label after first addendum and operational sign have been selected? In that case the label would be blank waiting for the second addend.

                          Any help is appreciated, hope there's a way that doesn't require too much code, but by what I'm thinking, conditional statements are key to make these work.

                          1 Reply Last reply Reply Quote 1
                          • S
                            Sawer
                            last edited by

                            Hello everyone!
                            Screen Recording 2022-02-18 at 11.35.21.gif

                            Trying to style this calculator here, I'm working on the customisation of the buttons.
                            I just want to set an animation that once a number is pressed, a background pops up and scales itself while fading thru opacity, (just like website buttons).

                            I'm currently running with 2 issues:

                            1. As shown in the video , once the mouse is gone, the buttons background goes away but the buttons frame remains until I press another button.

                            2. For the scaling and fading implementation, I've tried to set a Timer where the opacity of the background fades in 1000 milliseconds. It didn't work on the
                              if(obj.down) functions/Conditional Statement. Also want to know if there is a way to scale the rectangle by x.

                            Any Help is super appreciated. I'm so far happy of the improvements, just wanna add this little UX feature.

                            d.healeyD 1 Reply Last reply Reply Quote 1
                            • d.healeyD
                              d.healey @Sawer
                              last edited by d.healey

                              @Sawer Is that individual buttons or are you using a panel? You should be using a panel really.

                              Libre Wave - Freedom respecting instruments and effects
                              My Patreon - HISE tutorials
                              YouTube Channel - Public HISE tutorials

                              S 2 Replies Last reply Reply Quote 0
                              • S
                                Sawer @d.healey
                                last edited by

                                @d-healey Yes, True. That's what I'm working on now. almost done!

                                1 Reply Last reply Reply Quote 0
                                • S
                                  Sawer @d.healey
                                  last edited by

                                  @d-healey
                                  Watched your "Panel Timers" Youtube video. Thanks soo much for this.
                                  I'm currently having problems on running the timer. This is the snippet. If

                                  HiseSnippet 1428.3ocsWrsaaaCUJMpn1aEXcXe.D9gAYfTG41ltgEzsV6D2kslTi3tt9VAsDsEQoIMHoRrWQ+m2ev14PIYIm3lkZfIjHSdtvyEdtogZULyXTZO+FuY4blm+WGLZozl1Okxkdmbjm+2FzKyZURxKj7YTKWI85sbN0XXId9924kHc9M10y872+ROpfJiYUf77dqhGydEeF2VAc3y+ctPLflvdCeVMpexyOIVI6qDpLPmtSPj2bZ7GnSYmQQx1Ivy+tGmvsJ8HK0xL.M8TIKGkptTlS+a4F9XAC2z0aDbP4f85mxEICKsWimm+tCqr96ja8eWvo7D9J3UdguwgfTwQcef+N2jJ08KPk7qoR6lqROHXTrlO2VgA0muJ3DokomPAWccUImVuc5cuf9JfBosyL5GXCzvlUbD9znn8Hvq1G1roDbrFvIyH8oh3dVYyO1jKEbIiLISFiW3jXMCrr+jmLkYIgHG6QVrGYY6lM9XyFMDpXpfbYN5mQJELMIYHUxD0Y3Px9622cZIDGRfc3uRVLLzNmyzVNy.J8reazqOqf+82+k7K3xojJJ.NQ42nEHaaZKxOQ5BVlCRJiOM0tFHpPntDLRwXHjxfnZ0Wvgkjum7qpKX5V.YeB7IMHvS96bipSB0R6jhz.1WzgWGWBbYWCk6MbZEj.lEFlqKEdXomMrMXVNTjAEf1ibYJONkvMDclThF73LKQprjr4frP.y3jLN4HPvNOPtDaz3Bplr.zBaJ2zAj6aohLVHZPMZfvWPdHIpSW2dGMlRZVjST4+7IgKH+LXNswcNWbACV0bm5VbpepjC3BznDrNy0bos33VIFMaNEAWBslOtxAMDI4bUFXfrJ+yTzAMxtTrDLaaJiLOOnA49iMgyBWLE4OulQXzhChF3dbRaE5APDVXqSg2FlVSss1i73nZjjnoW9F1Bflt.pRO3qvH6dpLYhILp8JxK9AbSNBqhNZWhx4ytttMXPMc61nbai18oaPKw3z100QWPC8yDz3PplS.zN870PcBtcYXzUz+OuuOmjIPs9yQ8jkbNK1RkSErvMYEcO.BQosIf824.WwBRt9AYC3suLa1XHWwlRsP5mPP3Rr1jg4vZ3+Einl3VqKkCjNwjj4ZFVhrTqW2Sgu2bdOXampxLrqm3xt.pW0tYkiDbyNXEABWIwYsBHVcF6vJbqkdjmRwDF1McBSn.A27QTKWNWuhwZcrjZZl6UokZo57hTgOBaL.t9WLA5WPbrwKx9FmOJ.tz5pZYRUYhDxXFgOatfMCDDTYe7RhAtTK4Z0cQGRuhRYWpz3g14J1WQYzs2AUb.2N+S008529EKy+QyrYZYQ.wgMAdg+aBCoXrtXSEzn7Yk8N6TuSYXqwVIjthMfvWX21q+rpIqRdlxxdMzS.5.iBgbUTSlrQbXySsRHvpxa.cQ85OOig4YU6AlCj5uhPXBj0Gq4t2twZhy6kWiPk7DIGJdvJ1OPIRvwUv0WeHHuhgAfU+wIXONbtnBXUs9AXGwt.FrLeJoFAGwLe.5N4nc1b3VQhiaZcXue4LTXyCONH5f.3twaArvOADzxxEtAI.9taRwvq4yQTGx5iQfiFt9TDdiU5DldDTLp9Tv4POmlvyL0g6c8Q9fgMUIYBpc8IPwQsKPb0ovwQ6jFnzb8Qw+BFKM5FGK81phOHXH2FmtYcbmMnivM6+G5Xwv72O33ISfROUJ3tACd21N49+g3ymbY5oTqligUmkMaDzSLlARWBQcFLBaGL5NeeDtG8.iXxD2l+AdJP1E26WfraIRuYzXs58w4Ys3mKbOGDPmjtuNpQvo3dRWOWlLFkG0IxaF7kKuONFM+GBIbalmGsE773sfmmrE7bvVvyS2Bd9gsfme7F4A+nwWjYUEe3L.X3wtRZ99GKoPjkKJz6eAAGCS6
                                  

                                  The code is a little bit messy (Iteration purposes) but I've put some comments for more clarity. Any help is super appreciated.

                                  d.healeyD 1 Reply Last reply Reply Quote 0
                                  • d.healeyD
                                    d.healey @Sawer
                                    last edited by

                                    @Sawer What's the problem? Are you using develop branch?

                                    Libre Wave - Freedom respecting instruments and effects
                                    My Patreon - HISE tutorials
                                    YouTube Channel - Public HISE tutorials

                                    S 1 Reply Last reply Reply Quote 0
                                    • S
                                      Sawer @d.healey
                                      last edited by

                                      @d-healey Yes, I am.
                                      the problem is that when I click the panel, the Console says this "Accessing parameter reference outside the function call" So I do not really know where to place the parameter.

                                      d.healeyD 1 Reply Last reply Reply Quote 0
                                      • d.healeyD
                                        d.healey @Sawer
                                        last edited by

                                        @Sawer You need to use a different variable name

                                        0c7ce3a4-3560-47fe-9446-a939a1aa861c-image.png

                                        Libre Wave - Freedom respecting instruments and effects
                                        My Patreon - HISE tutorials
                                        YouTube Channel - Public HISE tutorials

                                        S 1 Reply Last reply Reply Quote 0
                                        • S
                                          Sawer @d.healey
                                          last edited by Sawer

                                          @d-healey Thanks so much man. It's working now.
                                          Want to ask if its possible to ad in the same timer a state where the opacity also fades.. the issue is that the counter goes up to scale the background, but the opacity starts from 1 and goes to 0 with an interval of 0.1, while for the background is of 1.
                                          Any Idea please?

                                          d.healeyD 1 Reply Last reply Reply Quote 0
                                          • d.healeyD
                                            d.healey @Sawer
                                            last edited by

                                            @Sawer Divide by 10?

                                            Libre Wave - Freedom respecting instruments and effects
                                            My Patreon - HISE tutorials
                                            YouTube Channel - Public HISE tutorials

                                            S 2 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            45

                                            Online

                                            1.7k

                                            Users

                                            11.7k

                                            Topics

                                            102.1k

                                            Posts