155
edits
Line 123: | Line 123: | ||
= | = Additional Infrastructure = | ||
The previous section was more concerned with the conceptually necessary pieces for a/the CDU. This section introduces the other elements the framework introduces in order to code a functional CDU. | |||
== ScratchPad == | |||
The ScratchPad is the input/output line in the CDU(s). The scratch pas as such is kind of different from the rest of the CDU(s) as the scratch pad messages are truly static, i.e. they happen to be displayed on all CDUs in the cockpit, no matter what the individual CDU is otherwise showing. | |||
<code> | |||
var ScratchPad = { | |||
# "STATIC" | |||
vector messages, | |||
scalar deleteString, # "DELETE"~"" | |||
func displayScratchPad(), | |||
func new(), | |||
# "PUBLIC" | |||
scalar me.input_string, | |||
func me.erase, | |||
# "PRIVATE" | |||
scalar me.pm_trigger, | |||
func me.plusminus(), | |||
func me.clear(pressedTime), | |||
func me.erase(), | |||
}; | |||
</code> | |||
== ListenerCollection == | |||
In order to update fields that are tied to a (potentially changing) property, fields that need a (potentially changing) property to compute their data can (and automatically will) register a property listener on the relevant properties whenever the relevant field is displayed. In order to unregister the listener for pages that are no longer displayed, the class CDU keeps a collection of the currently active listeners, such allowing the unregisterling for unneeded listeners. | |||
<code> | |||
var ListenerCollection = { | |||
# "STATIC" | |||
func registerInPropTree(path), | |||
func add(prop, field_id, subpage_id, side, lsk_index), | |||
func clearAll(), | |||
func new(ptp=nil), | |||
# "PRIVATE" | |||
scalar me.ptp, | |||
vector me.listener_list, | |||
vector me.property_list, | |||
}; | |||
</code> |
edits