OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Wait / sleep in macro?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sat May 03, 2003 4:23 pm    Post subject: Wait / sleep in macro? Reply with quote

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
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue May 06, 2003 9:36 am    Post subject: Re: Wait / sleep in macro? Reply with quote

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
View user's profile Send private message
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue May 06, 2003 11:32 am    Post subject: Re: Wait / sleep in macro? Reply with quote

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
View user's profile Send private message
guest
Guest





PostPosted: Sat Jun 07, 2003 6:54 am    Post subject: wait Reply with quote

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





PostPosted: Sat Jun 07, 2003 12:13 pm    Post subject: timer events? Reply with quote

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
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Sat Jun 07, 2003 2:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group