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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I cancel out of a zip operation?

General

How can I cancel out of a zip operation?

by  ChrisRChamberlain  Posted    (Edited  )
If you need to add compression to a VFP app, look no further than Craig Boyd's excellent VFPcompression.fll.

Free and fast, documentation and download are available at http://www.sweetpotatosoftware.com/SPSBlog/CommentView,guid,07ed8874-8781-4e76-878b-92b3f4cfc8b3.aspx#commentstart

Under certain circumstances, it's possible to utilise the callback feature to allow a user to cancel out of the current operation.

To enable this, try the following:-

Add two new properties .lCancel and .lUserDidCancel to an in scope object, say oObjectName

In the calling function/procedure/method put:-

Code:
[color blue]ZipCallBack([oObjectName.mZipStatus()])
ZipOpen([MyZipFile.zip],[C:\],.F.)
ZipFile([C:\SomeVeryLargeFile.txt],.F.)

IF oObjectName.lUserDidCancel
[tab]oObjectName.lUserDidCancel = .F.
[tab][/color][color green]&& Delete incomplete .zip file[/color][color blue] 
ELSE   
[tab]ZipClose()
[tab]ZipCallBack([])	
ENDI[/color]

Add a command button or other suitable control to the app and in the .Click() event put:-

Code:
[color blue]oObjectName.lCancel = .T.[/color]

In the callback function/procedure/method, oObjectName.mZipStatus(), put:-

Code:
[color blue]DOEVENTS

IF oObjectName.lCancel
[tab]oObjectName.lCancel = .F.
[tab]IF MESSAGEBOX(		;
[tab][tab][Do you want to cancel?],;	
[tab][tab][tab]4 + 32 + 0	,;
[tab][tab][tab][Cancel operation]) = 6
[tab][tab]oObjectName.lUserDidCancel = .T.
[tab][tab]ZipClose()
[tab][tab]ZipCallBack([])	
[tab]ENDI
ENDI[/color]

The above example works but you will need to determine for yourself under what other circumstances the methodology will work.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top