--- On Wed, 5/13/09, Ludovic Thébault <[email protected]> wrote:
> From: Ludovic Thébault <[email protected]> > Subject: Cancel a repeat with a button > To: "How to use Revolution" <[email protected]> > Date: Wednesday, May 13, 2009, 7:01 AM > Hello, > > How interrupt a repeat loop by a button ? > While a copy of a lot of files with rev, i want the user > can cancel the copy. > > repeat for each line l in it > if char 1 of l <> "." then > put convertpath(tstack&"/"&l) > into tpath1 > put convertpath(tlibrary&"/") > into tpath2 > get shell("cp > "&tpath1&&tpath2) > end if > end repeat > > Thanks. > Hi Ludovic, Change the repeat loop to something like this: ## enable button "CancelCopy" set the uInterrupted of me to false repeat for each line l in it if char 1 of l <> "." then put convertpath(tstack&"/"&l) into tpath1 put convertpath(tlibrary&"/") into tpath2 get shell("cp "&tpath1&&tpath2) end if wait 0 milliseconds with messages if the uInterrupted of me then exit repeat end repeat disable button "CancelCopy" ## Now set the script of your button "CancelCopy" to: ## on mouseUp set the uInterrupted of button "CopyFiles" to true end mouseUp ## The 'wait with messages' inside your repeat loop will allow the engine to react to clicks on the button "CancelCopy" HTH, Jan Schenkel. ===== Quartam Reports & PDF Library for Revolution <http://www.quartam.com> ===== "As we grow older, we grow both wiser and more foolish at the same time." (La Rochefoucauld) _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
