HelpStrings.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Created by Christian Jacobi, March 9, 1992 2:27 pm PST
Christian Jacobi, March 9, 1992 5:45 pm PST
Implements a simple help facility capable of displaying strings.
This is a generic callers view without knowledge how handles are created.
HelpStrings: CEDAR DEFINITIONS ~
BEGIN
Handle:
TYPE =
REF HandleRec;
NIL is a perfect Handle.
HandleRec:
TYPE =
RECORD [
class: REF ClassRec,
data: REF
];
ClassRec:
TYPE =
RECORD [
display: PROC [h: Handle, string: REF, key: REF ¬ NIL],
clear: PROC [h: Handle, string: REF, key: REF ¬ NIL],
makeVisible: PROC [h: Handle, data: REF ¬ NIL],
hide: PROC [h: Handle, data: REF ¬ NIL],
more: REF
];
Display:
PROC [h: Handle, string:
REF, key:
REF ¬
NIL];
Shows string string, if handle is visible. Remember key. Use short strings which fit in one line.
Clear:
PROC [h: Handle, string:
REF ¬
NIL, key:
REF ¬
NIL];
Clears up the display if either string or key do match (Pointer equality). Works only on erasable devices.
MakeVisible:
PROC [h: Handle, data:
REF ¬
NIL];
Tries to make handle visible. Makes sense for some classes. data is ignored if not understood by class.
Use this when starting a new context, or, on explicite user requests. Do not always make the help strings visible before using display.
Hide:
PROC [h: Handle, data:
REF ¬
NIL];
Tries to make handle invisible. Makes sense for some classes. data is ignored if not understood by class.
Use this on explicite user requests.
NoHelp:
PROC []
RETURNS [h: Handle];
Returns a dummy handle which isn't capable of displaying help. Treat this handle readonly.
END.