Hoi Andreas,
> 1. I've done a script (the one bekow), that after hiting start does
> some long calculations (could last 5 mins). During that a progress bar
> opens. The problem is that I want to be able to abort this calculation
> with a cancel button in the progress bar window . This will obviously
> not work, because the gui will only accept an input during the
> handle_app procedure.
> Is this even possible?
Yes, code after your "not work" follows:
[...]
/* this will work */
call Notify("progress","CloseRequest",1,"app","ReturnID","QUIT")
call Notify("cancel","pressed",0,"app","ReturnID","QUIT")
return
/* this is the function i want to leave, pressing the button */
lets_go: procedure
call set('win','Sleep',1)
call set("progress","open",1)
DO cds=1 to 10000
/* you have to call NewHandle() but don't wait for any signals */
h.NoWait = 1
call NewHandle("APP","H")
/* The only QUIT can be the Cancel-Button or the Close-Request */
if h.event="QUIT" then leave
/* counter for progress bar */
percent=trunc(cds*100/10000)
call set("gauge_glob_progress","Current",percent)
call set("gauge_glob_progress","InfoText",disk_nr" CDs found:" percent||"%")
call set("gauge_glob_progress","ShowMe",1)
END
call set("progress","open",0)
call set('win','Sleep',0)
return
--
cu, Bernd