Google
 

Rabu, 21 Mei 2008

Zeos 6.6.3-rc(Rev368) ZIBEventAlerter

Yesterday I had a chat with "mdaems" one of the ZeosLib developer, and now I know how this new component work :D. Here are the steps that you must follow:
  1. Drop the ZIBEventAlerter to your form and attach connection property to ZConnection
  2. Add events name in the Events property of ZIBEventAlerter (one line for one event)
  3. Set AutoRegister property of ZIBEventAlerter to false (because it still not work correctly even if you set it to true)
  4. Set Registered property of ZIBEventAlerter to false (if you set it to true it will create AV when your application start because it will register the event before the connection establish)
  5. Call RegisterEvents method of ZIBEventAlerter in OnAfterConnect event of ZConnection
    procedure TForm1.con1AfterConnect(Sender: TObject);
    begin
    ZIBEventAlerter1.RegisterEvents;
    end;
  6. It also a good practise to call UnregisterEvents in OnBeforeDisconnect of ZConnection
    procedure TForm1.con1BeforeDisconnect(Sender: TObject);
    begin
    ZIBEventAlerter1.UnRegisterEvents;
    end;
  7. Write your own action in OnEventAlert method of ZIBEventAlerter
  8. Run your appication and see the magic :)
This component also still need refactoring to became more generic, because the heart of Zeos is can be used with more than 1 database. So this component is still in development, but you can use for Firebird/Interbase right now :D

Tidak ada komentar: