John
(Fresh Scripter)
2002-06-26 08:07 PM
CopyFilePB

Just recently started using KixGUI and im having a ton of fun writing with it.

Attached below is a simple script that copies all files from my documents to network drive with a progress bar.

My question is: How can a control the progress bar if a user clicks cancel or kills its. Im trying to display a message to the user in the event the user hits the cancel or kills the PB.

Any help greatly appreciated

Regards

John

$frm=$root.createform("frm","COPY FILES",210,100,350,100)

$lbl1=$frm.addlabel("lbl1","Copying files from MY DOCUMENTS folder to your" +chr(10)+ "Network H: DRIVE" + chr(10)+chr(10)+ "PLEASE WAIT",10,2,300,200)
$lbl1.borderstyle=0
$lbl1.textalign=1 ;center

$frm.visible=1

;Copies all files from my documents to H: drive

$frm1=$root.createform("copyfrm","copy form", 200,200,300,100)
$frm1.CopyFilePB("c:\Documents and Settings\@userid\My Documents\*.doc","H:\My Documents",0,1)


Radimus
(KiX Supporter)
2002-06-26 08:13 PM
Re: CopyFilePB

very simple...

use Win2k and offline folders... [Big Grin]


John
(Fresh Scripter)
2002-06-26 08:20 PM
Re: CopyFilePB

Dont want to turn on Offline folders, to many training problems(believe or not).

Chris S.
(MM club member)
2002-06-26 09:42 PM
Re: CopyFilePB

When I tested, I found that when I hit 'Cancel' CopyFilePB returned a value of '1223.' Change your code like this...

code:
$rc=$frm1.CopyFilePB("c:\Documents and Settings\@userid\My Documents\*.doc","H:\My Documents",0,1) 

if $rc=1223
? "User hit cancel..."
endif



John
(Fresh Scripter)
2002-06-26 10:34 PM
Re: CopyFilePB

thanks Chris, thats perfect...

I kept trying to see what @error code it returned and of course it only returned one 0 ... still trying to get the handle on kixgui...

cheers

John


Chris S.
(MM club member)
2002-06-26 10:50 PM
Re: CopyFilePB

No problem. I might also suggest you use a system variable for your My Docs location. You can either pull the path out of the registry or you can use "%USERPROFILE%\My Documents."

John
(Fresh Scripter)
2002-06-27 12:39 AM
Re: CopyFilePB

Thanks again for the solution, tips and quick response..

Cheers

John


Alex.H
(Seasoned Scripter)
2002-06-27 06:43 PM
Re: CopyFilePB

John,
Kixgui don't set the @error value, for some particular reason (well, size of the dll is one of them)
On the other hand, the result is returned if you used a method (complete, error, something else), and yes there is a missing state in the manual. (same for copy, move and delete)