Mega Search
23.2 Million


Sign Up

Make a donation  
How to remove only one event from listening application?  
News Group: embarcadero.public.delphi.database.interbase_express

Hi. I've put six events in a TIBEvents.Events property. I wish that, when one of the events occurs I could remove just that one.
What is the best way to do that?
Also, IDK why, but passing True to CancelAlerts is not Canceling the Alerts... any tip?

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 13-Jul-2011, at 3:55 PM EST
From: Elton Barbosa
 
Re: How to remove only one event from listening application?  
News Group: embarcadero.public.delphi.database.interbase_express
> {quote:title=Adalberto Baldini wrote:}{quote}
> Events is TStrings you can manipulate it as you want :
> 
> ibevents.registered := False;
> ...... your choices ...
> ibevents.registered := True;
> 
> Adalberto Baldini

Hi,
Yup! you are right. TStrings are easy to manipulate. Thanks for reply!
On other side, maybe i wasn't clear. I want to do that *in response of an event*. 
But Help about OnEventAlert says that "You cannot call RegisterEvents, UnRegisterEvents, GetAutoRegister or SetAutoRegister from within an OnEventAlert event handler."
Also help about TIBEvents.RegisterEvents says "Note:  RegisterEvents is called automatically when you set the Registered property to true "
So seems your code will *not* work in my case...
Can anyone think in another alternative?
I am one step of using configuring a timer to do that as I can't think another way... :(

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 18-Jul-2011, at 9:23 AM EST
From: Elton Barbosa
 
Re: How to remove only one event from listening application?  
News Group: embarcadero.public.delphi.database.interbase_express
> You should be able to remove it from the stringlist, then Post a custom message 
> that your form listens for.  It should finish your event handler then process 
> the message queue, pick up your custom message and you can unregister 
> re-resgister based on the stringlist as it exists after you modified it in the 
> event handler.
> 
> -- 
> Jeff Overcash (TeamB)

I had to remove the event outside of the event handler. When tried do that inside of the event handler the application freeze.
But using an application message as suggested, outside of the event handler I Unregister/remove/add/Register again, and it works. (:

Thanks again Jeff,

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 19-Jul-2011, at 11:11 AM EST
From: Elton Barbosa