I modified the controls.prg sample you provided and added a check for test.dbf right before the use statement.
Here is the relevant section of controls.prg.
- Code: Select all Expand view
if file( "test.dbf" )
msginfo( "test.dbf found" )
else
msginfo( "test.dbf NOT found" )
endif
USE TEST
@ 20, 300 SAY oSay PROMPT "Browse" OF oDlg
@ 20, 380 BROWSE oBrw OF oDlg ;
SIZE 400, 300 ;
HEADERS "FIRST", "LAST" ;
FIELDS FIELD -> first, FIELD -> last
When I run the code it pops up message saying “test.dbf found” which is good.
Then when you press ok button it gets open error. If I comment out //use test
Then it gets dbedit error so I know it is on the “use test” statement.
I have tried searching on the internet but couldn’t find anything to help.
Have you been able to use dbf on android phone?
By the way DISTFILES += test.dbf does not get test.dbf onto android in any accessible location.
I added to FiveTouch.prg a little program like your other sample prgs to check for test.dbf in all normal android directories.
Then if it finds it in download directory it copies it and checks all directories again.
Here is that code.
- Code: Select all Expand view
// GFCheckDownload.prg
TEXT INTO cCode
#include "FiveTouch.ch"
function GFCheckDownload()
local cDownloadDir
local cDataDir
local cFile := "test.dbf"
local cMemo := ""
local nCounter, cDir
cDownloadDir := DownloadLocation()+"/"
cDataDir := DataLocation()+"/"
// Before updating Test.dbf from download dir Check all folders
cMemo += "Check Directories Before"+CRLF
for nCounter := 1 to 14
cDir := QStandardPaths():StandardLocations( nCounter ):Value( 0 )
cMemo += str(nCounter,2)+" "+cDir+CRLF
if .not. empty( cDir ) // If empty must be current directory
cDir += "/"
endif
if file( cDir+cFile )
cMemo += "Test.dbf Found"+CRLF
endif
next
if file( cDownloadDir+cFile )
// move test.dbf from download directory
cMemo += CRLF
cMemo += "Test.dbf copied from download dir"+CRLF
memowrit( cDataDir+cFile, memoread(cDownloadDir+cFile))
memowrit( cFile, memoread(cDownloadDir+cFile))
//__CopyFile( cDownloadDir+cFile, cDataDir+cFile )
//__CopyFile( cDownloadDir+cFile, cFile )
// ferase() does not seem to work on download directory. Must be permission issue
//ferase( cDownloadDir+cFile )
// Now check all folders for test.dbf
cMemo += CRLF
cMemo += "Check Directories After"+CRLF
for nCounter := 1 to 14
cDir := QStandardPaths():StandardLocations( nCounter ):Value( 0 )
cMemo += str(nCounter,2)+" "+cDir+CRLF
if .not. empty( cDir ) // If empty must be current directory
cDir += "/"
endif
if file( cDir+cFile )
cMemo += "Test.dbf Found"+CRLF
endif
next
else
cMemo += "Test.dbf not found in download dir"+CRLF
endif
MemoWrit( "FileInfo.txt", cMemo )
OpenFile( "FileInfo.txt" )
return nil
ENDTEXT
MemoWrit( "GFCheckDownload.prg", cCode )
Here is the results after running it.
- Check Directories Before
1 /storage/emulated/0/Documents
2 /system/fonts
3
4 /storage/emulated/0/Music
5 /storage/emulated/0/Movies
6 /storage/emulated/0/Pictures
7 /data/data/fivetech.WWMobile/cache
8 /data/data/fivetech.WWMobile/files
9 /data/data/fivetech.WWMobile/files
10 /data/data/fivetech.WWMobile/cache
11 /storage/emulated/0
12 /data/data/fivetech.WWMobile/cache
13 /data/data/fivetech.WWMobile/files/settings
14 /storage/emulated/0/Download
Test.dbf Found
Test.dbf copied from download dir
Check Directories After
1 /storage/emulated/0/Documents
2 /system/fonts
3
Test.dbf Found
4 /storage/emulated/0/Music
5 /storage/emulated/0/Movies
6 /storage/emulated/0/Pictures
7 /data/data/fivetech.WWMobile/cache
8 /data/data/fivetech.WWMobile/files
Test.dbf Found
9 /data/data/fivetech.WWMobile/files
Test.dbf Found
10 /data/data/fivetech.WWMobile/cache
11 /storage/emulated/0
12 /data/data/fivetech.WWMobile/cache
13 /data/data/fivetech.WWMobile/files/settings
14 /storage/emulated/0/Download
Test.dbf Found