Android Question Klaus Calculator

Shelby

Well-Known Member
Licensed User
Longtime User
https://www.b4x.com/android/forum/threads/anyone-created-a-simple-calculator.16314/

When I try to run the debug on the above calculator I find that a library is missing according to a popup message. Is there a way I can get that missing library? Also I get the following error when I run debug on the code.

B4X:
B4A Version: 9.00
Parsing code.    Error
Error parsing program.
Error description: Unknown type: ahlocale
Are you missing a library reference?
Error occurred on line: 55 (Main)
Dim Locale As AHLocale

I don't understand this error. Primarily this question is directed to Klaus but anyone's reply is appreciated. My first and only App is a calculator and I'm trying to make sense of it all.
 

DonManfred

Expert
Licensed User
Longtime User
USE the forumsearch to find it. The forumsearch IS working. AHLocale
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
After adding the AHLocale.jar file and the AHLocale.xml file which I can only assume act as a Library referred to above as AHLocale library, I now have the following log problems when I try to run the Klaus calculator.

B4X:
Undeclared variable 'locale' is used before it was assigned any value.
'That's fro line 387 ie:
Locale.Initialize
    LanguageID = Locale.Language
    FileName = "tapecalc_" & LanguageID & ".txt"


Undeclared variable 'locale' is used before it was assigned any value.
'Also from line 387


Unknown type: ahlocale
'From line 55 sub globals ie:
Dim Locale As AHLocale
End Sub


Are you missing a library reference?

Did I do the proper adding of the AHLocale files in order to satisfy the code suggesting the need for the AHLocale library?
 

Attachments

  • Calculator_TapeCalcV1_4_Klaus.zip
    14 KB · Views: 284
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
O.K.,
I guess you're suggesting I upload the code again. I'll try that. First I'll see if I can find a more recent version of the work.
Thanks
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
Right, I thought it was weird that I couldn't find an actual library but only those two files. I'll continue to see if I can find the AHLocale Library with searching.
Thanks again.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
ok I'll try that again but I had problems before.
Thanks
Off to work now.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You find the AHLocale library HERE.
At the bottom of the first post you can download AHLocale1_16.zip.
Unzip this file.
You'll get two files:
AHLocale.jar
AHLocale.xml
Copy these two files to your AdditionalLibraries folder.
Have you defined an AdditionalLibraries folder in the IDE menu Tools/Configure Paths? If no, you must define one and set in the IDE.
Then, in the IDE, in the Libraries Manager Tab check the AHLocale library.
If your IDE is already open, right click in the Libraries Manager window and click on Refresh.
This works !
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
What exactly have you done?
Have you tested the program from this thread : Tape calculator as it is?
Does it work?
Otherwise, post your project as a zip file (IDE menu File/Export As Zip), so we can see what you have done and test it.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
Thanks, I'm slowly cleaning up the code. I've had to initialize the tapecalc_en file (not knowing if is it is necessary but it stopped an error. Now the logs say "Unknown member: : txt from line 77.
i.e.
B4X:
File.Copy(File.DirAssets, tapecalc_en.txt, ProgPath, FileName)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You haven't answered my question:
Have you tested the program from this thread : Tape calculator as it is?

Do you have a tapecalc_en.txt file in the Files folder of the project?
This is needed!
It contains all the texts used in the program.
If you want the texts in french you need the tapecalc_fr.txt file.
If you want the texts in german you need the tapecalc_de.txt file.
These are included in the zip file from the link above.
 
Upvote 0

kanati

Member
Licensed User
Longtime User
without looking at the project...... I can see that you are passing the filename without quotes so it things there's an object tapecale_en with a member of txt.

B4X:
File.Copy(File.DirAssets, "tapecalc_en.txt", ProgPath, FileName)

Again... not looking at the code but that's the obvious error there. Whether the rest of the call is correct, I have no idea.

(But perhaps you should just nuke everything at this point and follow Klaus' suggestion and start from scratch and download the program from his link and try again without changing things.)
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
Thanks Kanati, that helped.
Klaus, yes to your questions but I used the v 1-16.zip.... I'll try the above link version after work if it's different.
Thanks
 
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
Longtime User
unknown member txt........
I don't get it either.
B4X:
Sub Activity_Create(FirstTime As Boolean)
    
    'SSS
    tapecalc_en.Initialize
    'end
    Dim FileName As String
    Dim i As Int

    If FirstTime = True Then
        File.MakeDir(File.DirRootExternal,"TapeCalc")
        
        Dim lst As List
        lst = File.ListFiles(File.DirAssets)
        For i = 0 To lst.Size - 1
            FileName = lst.Get(i)
            If FileName.Length >= 15 And FileName.ToLowerCase.SubString2(0, 9) = "tapecalc_en" And File.Exists(ProgPath, FileName) = False Then
                File.Copy(File.DirAssets, tapecalc_en.txt, ProgPath, FileName)

Off to work sorry.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
What exactly is your goal?
Testing our resistance in the willing to help you?
That's exactly what you are doing.
When you ask for help you must read carefully the answers and suggestions you get, and also the answer.
You were told in post #16 that your code is wrong:
File.Copy(File.DirAssets, tapecalc_en.txt, ProgPath, FileName)
it must be:
File.Copy(File.DirAssets, "tapecalc_en.txt", ProgPath, FileName)
In your last post, the error remains! You don't care about it !?
In post #13 you were asked to post your project so we could look at it.
You don't care about it.
So, finally what do you expect?
How could, should we help you when you seemingly ignore all suggestions.
 
Last edited:
Upvote 0
Top