Android Question Minor IDE bug?

RB Smissaert

Well-Known Member
Licensed User
Longtime User
B4X:
Wait For (File.CopyAsync(File.DirRootExternal & "/PhonePats/", strMainDBName, Starter.strSD_DB_Dir, strMainDBName)) _
        Complete (bSuccess As Boolean)

Where strDBName is a string variable in Main Sub Process_Globals()
For some reason strMainDBName is not highlighted (purple) in the above code.

Otherwise it shows fine highlighted eg:

B4X:
lblFileCopy.Text = "Copying DB, " & strMainDBName & " (" & strFileSize & ") ..."

RBS
 

Sandman

Expert
Licensed User
Longtime User
This might one of the few cases where it's actually appropriate to post code as a screenshot. :)
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Ok, but then why does for it for example highlight if you do:
As far as I can see it doesn't unless you omit the declaration in which case it is highlighting it as an error, not because it is a string

2021-02-13_142426.png
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
I misunderstood, I thought you were expecting the variable name to be highlighted like a String because it was a String variable. Yes I agree, it does not highlight within the WaitFor so it does look like a bug!

Indeed.
Will find a better way to post images for next time.

RBS
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Indeed.
Will find a better way to post images for next time.

RBS
I just use the "printscreen" key and past it in place and resize as needed
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
so it does look like a bug!
Something like this will work. See working code and screenshot that shows the purple
B4X:
Public str1name As String ="andrewOne.txt"  'Process_Globals
Public str2name As String ="andrewTwo.txt"

B4X:
Dim sf As Object = File.CopyAsync(File.DirInternal, str1name, File.DirInternal, str2name)
    Wait For (sf) Complete (Success As Boolean)
    If Success Then
        Log("file was successfully copied")
    Else
        Log("Sorry, file copy failed")
    End If
 

Attachments

  • andrew.PNG
    andrew.PNG
    6.4 KB · Views: 193
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Something like this will work. See working code and screenshot that shows the purple
B4X:
Public str1name As String ="andrewOne.txt"  'Process_Globals
Public str2name As String ="andrewTwo.txt"

B4X:
Dim sf As Object = File.CopyAsync(File.DirInternal, str1name, File.DirInternal, str2name)
    Wait For (sf) Complete (Success As Boolean)
    If Success Then
        Log("file was successfully copied")
    Else
        Log("Sorry, file copy failed")
    End If

Yes, that highlights the variable, but no need to declare the variable Public and no need to assign an initial string.

RBS
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Yes, that highlights the variable, but no need to declare the variable Public and no need to assign an initial string.
The important thing is: Does it do the job in copying the file and give you the purple color you were looking for. That is more important than the variables declaration because I do not know the rest of your code. The declaration was just there just to have variables.
 
Last edited:
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
The important thing is: Does it do the job in copying the file and give you the purple color you were looking for. That is more important than the variables declaration because I do not know the rest of your code. The declaration was just there just to have variables.

You confused me initially by thinking the variable needed to be Public and have an initial value assigned.
The only thing that made the difference is how the Wait For is coded.

RBS
 
Upvote 0
Top