Class MultiSignal

Introduction

This class provides a mechanism for signaling multiple Synergy/DE UI Toolkit events (often called "menu entries") before consuming any of them. The standard mechanism for signaling these events (M_SIGNAL) obliterates all except for the last event signaled. That can be problematic when methods that get invoked one after another each signal their own event.

MultiSignal implements an event queue. Signaling an event adds it to the queue, and consuming an event removes and returns the first one signaled. The queue itself is also exposed as a public property, so client code can deal with events in any order desirable. For compatibility, the signaling method also calls M_SIGNAL.

Even though this is implemented as a class, the recommended usage is through the function-like macros multi_signal and multi_remove.

The supplied test program, test_multisignal.dbl, demonstrates both the original problem and how MultiSignal solves it.

Contents

  1. Introduction
  2. Contents
  3. Explanation of symbols used
  4. Member reference
    1. list - Retrieve the list of pending events
    2. remove - Remove and return one event from the queue
    3. signal - Signal a new event

Explanation of symbols used

Words in italics indicate an instance of a class. The word corresponds to the class name, except where more than one instance is represented in the same statement. In that case a number (2, 3, etc.) is appended to the class name.

Words in normal typeface are to be taken literally (required punctuation, class name in a static reference, method name, etc.)

The symbol => is used to separate an expression (on the left) from its return value (on the right).

An ellipsis (...) indicates that the previous argument may be repeated any number of times. The description will indicate whether one instance is required.

Member reference

static property list

MultiSignal.list => ls
Returns the list of pending events as an ls. This list contains strings, in the same order as the events signaled. In other words, element 0 will be the earliest event. Modifications made to ls will affect future calls to multi_remove.

static method remove

MultiSignal.remove() => string
multi_remove() => string

Removes the first (earliest) entry in the event queue, and returns it as a string. If the event queue is empty, returns ^NULL. This method does not alter anything in the UI Toolkit.

For convenience, the macro "multi_remove" can be used instead of "MultiSignal.remove".

static method signal

MultiSignal.signal(a) => boolean
multi_signal(a) => boolean

Adds a string containing the upper-cased value of a to the end of the event queue. For compatibility, it then passes a to M_SIGNAL. This also insures that if signaled during a direct callback, the calling routine will exit back to the client program.

For convenience, the macro "multi_signal" can be used instead of "MultiSignal.signal".