| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Sat May 03, 2003 4:23 pm Post subject: Wait / sleep in macro? |
|
|
I'm writing a short macro for OO.o Writer... one of the things that I need to do is loop continuously updating a time counter. Since the counter only needs seconds resolution, I'd like the loop to run only once a second.
It is suggested in the help for Basic that the Wait command would do what I'm looking for - however, in my copy of OpenOffice 1.0.1 (linux) running Wait 1000 (or whatever) puts OpenOffice in a busywait loop.
Would there be a feasible alternative to using the Wait command? or should I simply upgrade OpenOffice?
Thanks,
-Karl |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Tue May 06, 2003 9:36 am Post subject: Re: Wait / sleep in macro? |
|
|
I'm using OOo 1.1beta on Win XP.
I find that Wait just seems broken. It does NOT wait for a specified number of milliseconds as advertised.
But of course, other than that, I'm finding StarBasic pretty limiting. |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
Posted: Tue May 06, 2003 11:32 am Post subject: Re: Wait / sleep in macro? |
|
|
Here is an example of where I tried to slow down some animation using the Wait statement in StarBasic.
http://kosh.datateamsys.com/~danny/OOo/StarBasic/BouncingBall-20030503-1.sxd
Download the draw document. Open the draw document. Click the "Start Bouncing Balls" button. A bouncing ball appears.
If you look into the Macros, see the Standard Library, and the module BouncingBalls. Then see the AnimateBouncingBall() subroutine. Towards the end, at the end of the animation look, there is a commented Wait 1. I wanted to make this say something like Wait 100, to put in a 1/10 second delay between animation steps, but no such luck.
Wait appears to be broken. |
|
| Back to top |
|
 |
guest Guest
|
Posted: Sat Jun 07, 2003 6:54 am Post subject: wait |
|
|
I used the following workaround:
1. get seconds since midnight and store it into a variable
2. add the desired number of seconds to wait to the value of the variable
3. loop until the value of seconds since midnight is greater than your variable.
It is not elegant, but it did the task.
HTH
J. Staehler |
|
| Back to top |
|
 |
georgir Guest
|
Posted: Sat Jun 07, 2003 12:13 pm Post subject: timer events? |
|
|
| what is actually needed here is a OnTimer event listener... but with so limited docs i have no idea how to go about it. so far i've seen examples about onmodify and onselectionchanged in calc for instance... i assume there are lots of other events that could be processed just have no idea how to use them. |
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Sat Jun 07, 2003 2:38 pm Post subject: |
|
|
The problems may be OS related, Certainly the code below works as expected on my config without locking up the system
| Code: | sub test
start = timer
wait 12000
msgbox timer-start
end sub |
|
|
| Back to top |
|
 |
|