Flush Event Queue Function

Owning Palette: Events Functions

Requires: Base Development System

Discards the least recent notify events from one or more event queues. If the event queue that you want to discard includes filter events, this function stops at the first filter event in the queue and discards only the events that occurred previous to the stop.

Details  

 Add to the block diagram  Find on the palette
oldest event time is the event timestamp, in milliseconds, when you want to start keeping events. This function discards all events previous to the event time you specify. This millisecond timer can accept the value returned by the Tick Count (ms) function.
event registration refnum is a reference to an event registration refnum associated with the queue you want to flush.
include static events? specifies whether you want to include the enqueued static events associated with an Event structure in the flush operation. The default is TRUE if you place the Flush Event Queue function in an event case of an Event structure. Otherwise, the default is FALSE.
Note  If you wire include static events?, you must place this function inside the Event structure that handles the static events you want to include or omit from the flush operation.
event type or object specifies which notify events you want to discard within the criteria set by oldest event time and keep most recent. Refer to the Details section for more information about how to specify which events you want to discard.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
keep most recent specifies the number of most recent events to keep in the event queue. If you wire the event type or object parameter, keep most recent affects only the events of the type you specify. If you flush more than one event queue, keep most recent includes the total number of events to keep from all specified event queues.
Note  If you leave both oldest event time and keep most recent unwired, the function discards all events in all queues that meet any criteria set by event type or object. If you wire both oldest event time and keep most recent, this function keeps all events starting at the event time you specify and all events within the number of most recent events you specify.
event reg refnum out returns the event registration refnum associated with the flushed event queue.
number of events discarded returns the total number of discarded events.
error out contains error information. This output provides standard error out functionality.

Flush Event Queue Details

For applications where events occur in rapid succession but the application only needs the most recent events, such as Mouse Move or Panel Resize events, you can discard the older events so the application can respond to the newer event data more quickly.

The following examples show how you can wire data to the event type or object parameter to specify the way the Flush Event Queue function discards events.

Example 1: Discarding More than One Event Type

If you want to discard more than one event type, such as Mouse Down and Mouse Up, you can wire an array or cluster of event type enums to the event type or object input, as shown in the following example.





Flush Event Queue discards both the Mouse Down and the Mouse Up events regardless of the event source. However, because a constant value of 1 is wired to the keep most recent parameter, the function keeps one of the most recent Mouse Down or Mouse Up events in the event queue. Furthermore, the function keeps only one event total rather than one event for each event type.



Example 2: Discarding Events Generated by Specific Objects

You can wire a VI Server reference that points to an object that generates an event, a user event refnum, and any refnum with associated events to the event type or object input to discard only the events generated by a specific objects. To discard events from multiple objects, use an array or cluster of refnums, as shown in the following example.





Flush Event Queue discards any type of event generated by the objects linked to the references that are bundled in the cluster.



Example 3: Discarding Specific Events Generated by Specific Objects

If you want to discard an event only when a specific object generates that event, you can bundle an enum that contains the event type you want to discard with a refnum that points to the object that generates that event. You also can create a cluster or array of event type enum/object pairs to discard multiple events associated with multiple objects, as shown in the following example.





The function discards the Mouse Up or Mouse Down events only when the Boolean generates those events.
The function discards the Mouse Move event only when the 2D Picture control generates that event.
Because the event is not paired with a specific object, the function discards the Key Up event when any event source generates that event.