Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileXtra URGENT 2

Status
Not open for further replies.

Baixinha

Programmer
Dec 27, 2000
122
BR
Does Anybody have any example to help me with this xtra?

I'm using the xtra FileXtra3 to save some images that are in CD-ROM when the user clicks on the button, but is not working correctly. I'm learning to use this xtra now and I don't know if my code is correct. I need to open a dialog box Save As, and when the user clicks on save, the program verify if there is space on HD, and after save the image.

on mouseup
fxObj=xtra("FileXtra3").new()
put fxObj.fx_FileSaveAsDialog("c:\","Arte_01.tif","Save As",True)
fxObj=0

if fxObj.fx_FileGetSize("..\images\Arte_01.tif") > fxObj.fx_VolumeGetTotalBytes("c:\")then
--here I need to verify the volume that the user selects
alert("Out of Space!")
else
put fxObj.fx_FileCopy ("..\images\Arte_01.tif","c:\Arte_01.tif")
--here I need to copy the image Arte_01.tif from CD_Rom to
--the folder that the user selects
fxObj=0
end if
end
 
Ok, sorry for the late delay, you were so close too.

the error occurs when you set fxObj=0 after your FileSaveAsDialog as it destroys the fxObj so that the following commands don't have an object to call to. The docs don't really cover that. Leave the last fxObj = 0 in or it will eat you RAM.

 
oh, and thanks for bringing my attention to this xtra, will be a big help in the future.
 
My code is like this. The error occurs when I try to save a image that's into the folder oni\images, because my .exe is into the folder interface and I need to back to the CD Drive and access the folder oni\images.

on mouseUp
global salvar
global erro

fxObj = xtra("FileXtra3").new()
put fxObj.fx_FileSaveAsDialog
("c:\windows\desktop","Foto1.bmp","Salvar Como", True)
into salvar

put fxObj.fx_FileCopy(the applicationPath & "\oni\imagens\foto1.bmp",salvar) into erro

if erro = 0 then
alert ("Não foi possível salvar o arquivo.
Possível erro - Espaço em disco insuficiente. Libere
espaço e tente novamente.")
end if

fxObj=0
end
 
Ok, so your .exe is on the CD?
And your folder layout is something like
CDDRIVE:\interface\*.exe
CDDRIVE:\oni\images

(is it it images then your code has a typo, in the line
put fxObj.fx_FileCopy(the applicationPath & "\oni\imagens\foto1.bmp",salvar) into erro.
you are calling for a folder imagens, not images)


here is something that might help if the typo above isn't the problem.

on mouseUp
global salvar
global erro

fxObj = xtra("FileXtra3").new()
put fxObj.fx_FileSaveAsDialog
("c:\windows\desktop","Foto1.bmp","Salvar Como", True)
into salvar

-- this code will get the drive letter of the CD drive
set the itemdelimiter = ":"
cddriveletter = item 1 of the applicationPath

-- then use that drive letter in your file copy message
put fxObj.fx_FileCopy(cddriveletter & ":\oni\imagens\foto1.bmp",salvar) into erro

if erro = 0 then
alert ("Não foi possível salvar o arquivo.
Possível erro - Espaço em disco insuficiente. Libere
espaço e tente novamente.")
end if

fxObj=0
end
 
Excuse me the delay, your post was helpful.


Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top