Please let me know if I'm doing something stupid here...
repeat
info = CheckEvent()
until not(info.triggered)
Hollywood complains it's the wrong usage/parameters for CheckEvent - but this looks to me as the documentation suggests. This is on Icaros 2 with Hollywood 6.
Cheers,
Nigel.
checkevent on AROS?
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: checkevent on AROS?
Are you trying to call CheckEvent() from a callback function? That won't work...
Re: checkevent on AROS?
I did same mistake(s) with CheckEvent() too.
First of all, you cant have a checkevent that is happening inside checkevent event.
And second thing is, that there are only very few instances where you should CheckEvent() at all. Instead you should use WaitEvent().
Problem with CheckEvent() is that it keeps checking every possible thing in your computer if something have been called, and from platform to platform to computer to computer even, results might differ. While it may work for you just fine, it might be that on another computer there is terrible sound distortion, lag etc. due to that.
While if you use waitevent(), it will instead wait until that event is triggered rather than keep constantly checking for it itself.
Programming wise you can do everything with waitevent as you can do with checkevent, but you have to think it bit different way.
For while checkevent it is quite straightforward to get things go the way you like, with waitevent you have to think bit differently.
At first you would think that using waitevent has a problem that it stops the program to wait for some event to happen, hence if you for example have a button and there is some moving animation above that button happening, at first glance it seems like this cant be done, but it can.
You can check commands like:
InstallEventHandler(), SetInterval() and SetTimeout().
As example, SetInterval can set some function to be executed every x amount of microseconds. For example, you could set function called my_moveanimationabovebutton to be executed every 40 microseconds. This would mean that when you have in your code a spot like:
Instead of program halting its execution and nothing happening until one of the events is triggered, Hollywood would keep executing function "my-moveanimationabovebutton" every 40 microseconds, which is practically 25 fps.
Hence, you in practice you can do the same stuff as you can with CheckEvent(), you just need to think it bit different way.
First of all, you cant have a checkevent that is happening inside checkevent event.
And second thing is, that there are only very few instances where you should CheckEvent() at all. Instead you should use WaitEvent().
Problem with CheckEvent() is that it keeps checking every possible thing in your computer if something have been called, and from platform to platform to computer to computer even, results might differ. While it may work for you just fine, it might be that on another computer there is terrible sound distortion, lag etc. due to that.
While if you use waitevent(), it will instead wait until that event is triggered rather than keep constantly checking for it itself.
Programming wise you can do everything with waitevent as you can do with checkevent, but you have to think it bit different way.
For while checkevent it is quite straightforward to get things go the way you like, with waitevent you have to think bit differently.
At first you would think that using waitevent has a problem that it stops the program to wait for some event to happen, hence if you for example have a button and there is some moving animation above that button happening, at first glance it seems like this cant be done, but it can.
You can check commands like:
InstallEventHandler(), SetInterval() and SetTimeout().
As example, SetInterval can set some function to be executed every x amount of microseconds. For example, you could set function called my_moveanimationabovebutton to be executed every 40 microseconds. This would mean that when you have in your code a spot like:
Code: Select all
repeat
waitevent()
forever
Hence, you in practice you can do the same stuff as you can with CheckEvent(), you just need to think it bit different way.
Re: checkevent on AROS?
Ah, yes, it was in a callback routine. I had used BreakEventHandler before this and even tried removing and then resetting the event handling routine, but I guess nothing happens until the callback is returned from.airsoftsoftwair wrote:Are you trying to call CheckEvent() from a callback function? That won't work...
Cheers,
Nigel.