[Gambas-user] Fw: Shell with wait does not wait till work complettion
tobi
tobiasboege01 at ...1601...
Mon May 21 21:42:47 CEST 2012
On Mon, 21 May 2012, sundar j wrote:
>
> TextLabel.Text = "Copy in progress"
>
> Shell "cp -r <src> <dst>" Wait
> TextLabel.Text = "Completed."
>
> I used above code in my application. Shell indicated that all files are being copied one-by-one. But TextLable did not display Copy in progress. I did lot of experiment with the above code. Finaly i got it working by adding time delay just before shell command. Now my code looks like this :-
>
> TextLabel.Text = "Copy in progress"
> wait 0.1
>
> Shell "cp -r <src> <dst>" Wait
>
> TextLabel.Text = "Completed."
>
> I really have no clue why code worked after inserting time delay.
>
For public again:
Actually, it does not depend on the *delay*. If you use the WAIT instruction, the interpreter
re-enters its event loop. Only in this loop, changes to the GUI are made effective. So just call
Wait
without any parameter so that the interpreter spends only as long there as it needs to process all
the pending events and refresh the GUI.
You can read that on: http://www.gambasdoc.org/help/cat/eventloop?v3
Regards,
Tobi
More information about the User
mailing list