I don't undestad how to implement your file with my calculator.
Anyway thanks for your help.
If I want to fix at least one error (result not visbile and 00:25 reproduced 2 times), do you know why I get this error in the picture? what is wrong with my last changes in the code?
Before I dive into your code, I would like for you to familiarize yourself with Reverse Polish Notation (RPN)
in its simplest form, without a stack.
That's the technique I used in my ABG_Mart sample, where the + button acted as an immediate command to add the textbox text to the running sum in the Label.Text.
If I had a - button, I would have subtracted the textbox.text from the Label.Text.
This makes it unnecessary to have a = button or Enter button, since the running sum is always available.
Your app might be trying to emulate a more complicated scheme, where you are mimicking math formulas. That would be unhelpful for this kind of calculator.
I implemented the "-" button as per your suggestion. The calculator works well, but it doesn't fully meet my needs.
I created a condition to prevent starting with negative hh:mm, but this condition doesn't work correctly when calculating a successive negative time. ex "05:00 - 06:00". Instead of displaying "-01:00", it incorrectly shows "0-1:0-0" in the "Result" label.
Additionally, the current input sequence is not intuitive. For example, if I want to calculate "00:30 + 00:50 - 00:25", the user must press the buttons in this order: "00:30+" "00:50+" "00:25-". This is not user-friendly. Instead, the sequence of inputs should be "00:30+" "00:50-" "00:25", and then an equal button "=" for calculation. The "equazione" label should display: "00:30+00:50-00:25 = Result".
Another problem is that the label equazione expand vertically, but I prefer that remain in one line and the user can scroll horizontally to see the entire equation.
Am I missing something here?
Consider I am at a very low level initial stage with mit app inventor and programming is not my job.
ask user input like this, with no space, or you can replace all space and \n with "".
then check if the length is 6n+5.
then separate the string (length 5 +length 6+length 6+....) into a list
then sum up this list.
Maybe I'm not explaining my needs clearly. I need this app for myself and some colleagues to easily calculate the total flight time we've accumulated as pilots. Using a numpad we should easly add or subtract some hours.
Now, after summing up many hours, I need an "equals" button to finalize the calculation. I also need an option to subtract hours for verification purposes. Additionally, there should be a way to edit the current equation in case a user enters an incorrect time.
I've created the latest .aia file in an attempt to improve it based on your suggestions, but I'm completely lost in the code.
I know that we can have different point of view, but I need this function at least because is not natural the sequence of imputs when we have to subtract flight time that are from a different category. Is not like the most common calculator.. The current input sequence is not intuitive . For example, if I want to calculate "00:30 + 00:50 - 00:25" , the user must press the buttons in this order: "00:30+" "00:50+" "00:25-" . This is not user-friendly. Instead, the sequence of inputs should be "00:30+" "00:50-" "00:25" , and then an equal button "=" for calculation. The "equazione" label should display: "00:30+00:50-00:25 = Result" .
the reason is to get a total flight hours, than calculate from the total only the hours at night or day etc by sutract some hours we have logged in the logbook. So I need to subtract but in a user friendly way. I hope to cleared better my needs. Thanks as always for your big help.