Calculator Project
-
@ustk Ahahah It's a challenging but cool project. I'm learning a lot!
Thanks so much guys. -
@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.
-
@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. -
@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
-
@d-healey Thanks a lot!
-
HiseSnippet 1155.3ocsW1uahaDD.eMI9zg6Gpmz8.rG+EQIkCx2mRSaBjjJT9BURipTzoSarWBqhYWqcWmFTUj56SeI5iTeCZmwFBlD7o.zCIDL67g+Mi2c73VZkO2XTZhSwK5GwINesa69Ra2FcYBIo4A3B6aLhajmE2yPp2OhYL7.hiyB+LZgSwEIIe9mepNKjI84iVhPtTI74mH5IriVs0dGKBCOhEvuPzKi0quWSekrgJTECzrfaURDy+V1M7yXnYEbINu5v.gUoaaYVtg3rXcUP+1cU+tL09KEFw0gbTnFoMDnzkOREFfDiqRZzUDFzZXVaHPTZMpFrPZM3stmJBDOt9nZw2knfNxir0CmBii2BigWsr3UMCdS.ImLHsXJRuwssuVDYGoA44qbaJsbcGFT1yhRpsjB+0BtMTfERakdra4GoAgG8nbs0ptBcsUqtzNdddPs2Xo2wzznvXCcW5PGugaan5EojfP4RnxRfC3uULnJoUqBavBCuFtcUVEgYLFwQATF2qtUBg7pOtiWGklVV.BU2gJn+.sF96xKuj2e3UrXpkUhhMcKO4qOXQI5xTwRvkXn8WI9XE5DXAzN.lGvLzySHCERNsSrz2JTR5.CJ6OL9q.7FFyW58u21UXnQLMr2CJWFJSC9An2X+SNo99MN9cui1b7nYn2vkbMbw6S8YRZWXaGMPzoCWCQlBATdioBjldEwhhPFvuGJCCR4Dwy6LBEL+7JJ5TNkHuhX8AxPiJjWIRKfhQhOncO.lheeZ9kdy34oGVqyD4jP+jXWZ4RIU3Gf.+r3xBBvhasUP5WMIbnHdq5RLliHCuNzxIaVdT4Rzc2kVahYTo1bXaSPJlkFlZXvWchAOT4yBol3doExZvNCz1DciGYvFbefm2nhi7LkketrbB+fJ5SU0oyD0MXaVHWOQ0XWM8myQrzcMWm8lAZHbTe79Gt42+Ha6M+zyIYLTIaJE1yi3x7Z5QFb3B92u17.lkgMcFrFXWDWaEHBNGvuC5fm1Bpn6AbysVUDz24wSjDmWaSz9sCZPUO1ZURh.5C8JWHSqRtO6SD5mUvvti2T1RygCuXaKg4TUOHnLMXlSAtjA4K1w8DNSKQKr76sCaa9hQnVtH7i6MLf0lAXlBDVMOD9yi2a1qBqNMUg0xsJbwbfvZSCBqmaU3p4.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.
-
@sawer Add a label to display the output and add an = button that when pressed carries out the calculation.
-
@d-healey Thanks.
Given some tome to try understanding your code:- How did you come up with he appendInput function , especially the "+="
- What's eval? There's no this such as that in the Api.
I'm learning a lot. Thanks
-
@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.
-
@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. -
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.I'm getting excited to improve it just a little bit, and by that I have 3 questions:
-
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).
-
Is there a way to not "show" the operational sign to the label without affecting the input?
-
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.
-
-
Hello everyone!
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:
-
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.
-
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.
-
-
@Sawer Is that individual buttons or are you using a panel? You should be using a panel really.
-
@d-healey Yes, True. That's what I'm working on now. almost done!
-
@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. IfHiseSnippet 1428.3ocsWrsaaaCUJMpn1aEXcXe.D9gAYfTG41ltgEzsV6D2kslTi3tt9VAsDsEQoIMHoRrWQ+m2ev14PIYIm3lkZfIjHSdtvyEdtogZULyXTZO+FuY4blm+WGLZozl1Okxkdmbjm+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aL.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.
-
@Sawer What's the problem? Are you using develop branch?
-
@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. -
@Sawer You need to use a different variable name
-
@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? -
@Sawer Divide by 10?