10.07.2015 Views

Programming Guide - Actian

Programming Guide - Actian

Programming Guide - Actian

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

How You Can Communicate with an External Program Using External User EventsFirst, you register a frame (or frames) with OpenROAD to receive a particularevent. Then, when the event occurs in the external program, the programnotifies the OpenROAD application, which adds the user event to theapplication's native event queue.When the event reaches the top of the queue, OpenROAD dispatches the eventto those frames registered to receive the event. When the event reaches thetop of the frame's event queue, OpenROAD executes the event code for theuser event.This feature lets you send a message from the external program to theapplication notifying it, for example, to update its display or check thedatabase for changes. You can also pass one integer value along with the userevent, such as a record or file ID. Since both the OpenROAD application andthe external program can have open sessions to the same database, thisprovides a good way for the two programs to interact.Unless the communicating programs are both OpenROAD applications, usinguser events to communicate is a one-way process, from the external programto the OpenROAD application. If both programs are OpenROAD applications,each can call a 3GL procedure to communicate with the other.The basic steps for using external user events are:1. Use the 4GL RegisterUserEvent method in a frame script to register theexternal event.2. In your frame script, write the event block for the external user event. Theevent block for the user event contains the code that is executed when theexternal event is triggered.3. Using the routines described in How You Can Register the External Event(see page 348), write a 3GL program that sends the event from yourexternal program.4. Compile your 3GL program and link it as an external program.How You Can Register the External EventWhen you want a frame to receive a particular event from an externalprogram, you must register the frame with OpenROAD for that particularevent. Registering a frame tells OpenROAD to notify the frame whenever anexternal program sends the specified event. For example, if frame A isregistered to receive the external _update event, whenever OpenROADreceives the external_update event from the external program, it notifiesframe A that the event has occurred. OpenROAD then adds theexternal_update event to the event queue. (If the specified frame is notrunning at the time, OpenROAD simply ignores the event. This does not causean error.)348 <strong>Programming</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!