Can Someone help me with the calculator example with respect to the decimal point , the input method: algebraic and overall this application is as simple as possible . The buttons are created by code.
As already suggested by LucaMS you need to improve the layout.
Be aware that TextSize is density independant !
So setting it proportionally to teh view height works only with a density of 1 !
When using pixel values you must use dip values.
To check why the "." doesn't work well put a breakpoint in the code and go through it step by step.
When you post a project post it as a zip file (IDE menu File / Export As Zip).
I debug a little the code and I found that when you put a "0." it fails.
I add a line in your code and now it works fine (I think).
B4X:
Case Else:
If Label1.Text <>"0" Then Str =Label1.Text & Str
If Label1.Text ="0" AND Str="." Then Str =Label1.Text & Str 'line added
Num1=Str.Replace("Infinity","")
I'm not sure what you are after, but I have been using the code for SCalculator [by Derez] as my B4A training exercise. It is far more complex than your sample code but may be of use as a tutorial. http://www.b4x.com/android/forum/threads/scalculator.6832/
Regards Roger
PS From the comments above, you may want look creating buttons etc with an external graphics program. If you have any experience with the likes of Photoshop, Gimp is a good free alternative but a steep learning curve. Paint.net at Download.com is an easier start.
The complexity is due to the need to perform operations by the mathematical correct order.
Also the input method is not by keyboard so I had to create an input algorithm by myself.
The complexity is due to the need to perform operations by the mathematical correct order.
Also the input method is not by keyboard so I had to create an input algorithm by myself.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.