Introduction to Screen Management Tutorials ¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢¢ Besides this introduction, there are eight tutorials on screen management topics: Buttons, Data, Menus, Containers, Graphs, Special Input and Displays, Printing, and s-Context Variables. They are meant to be studied in the order just given. They treat all display classes and all attributes. These tutorials are intended to be introductory, to enable you to learn the rudiments of the screen management system, s, and to get started doing some actual programming in it -- which is itself the best way to learn. Consequently, they have been kept as simple as reasonably possible: Generally, each attribute is discussed in the context of only one display class. Some details of its use or its values may be left out. For example, the matrix form for specifying the value of the label attribute is omitted. Some complexities are glossed over; therefore, code which behaves in a certain way in an example may not behave in the way you expect under other circumstances. The order in which attributes are specified within a single statement, for instance, may have a substantial effect on the resulting display. All or part of the response of A+ to an input is often omitted. This omisssion makes it easier to run through an example pressing the F2 key on on each input line and eliminates a great deal of repetitive material. You can see the response on the screen in the A+ session log when you execute the examples. You can reduce the response still further by executing s.QUIETû1, which suppresses s information messages but not error reports. Alternate ways of doing things are often not included. The ones discussed are considered common or useful, but there may often be ways that are simpler or otherwise more desirable than the ones mentioned here. You should consult the A+ Reference Manual when you need to know whether a certain attribute applies to a particular display class or what the full set of its possible values is, when there seems to be some inconsistency, when you want to do something that seems difficult or impossible from the descriptions given here, and so on. After you have absorbed the material in the tutorials, it might be helpful to browse in the manual, or even read it through. If you get an A+ error message and a star in the next prompt, perhaps because you pressed F2 on an output line or or a line of text or you entered an erroneous statement, you should immediately clear the error by entering ý. To enter this character, press the right-bracket key while holding down the Meta key (on Sun keyboards) or the Alt key (on IBM keyboards). There are two equivalent Meta keys, usually marked with diamonds and located on either side of the space bar. The right bracket key is the second one to the right of "p". ( "[ ]" are brackets, "( )" are parentheses, and "{ }" are braces.) If your session gets messed up for some reason or other, enter $off, press F4 when the session has ended, execute the $load s, scrû..., and br{...}:... statements, and go on either from the beginning or from the spot where the variables and functions you need in order to continue are defined; this is often right after previously used variables have been expunged (using _ex). Visibility One problem in an s tutorial is maintaining the visibility of the tutorial and the A+ session log, despite the displays. To do this as much as possible, we keep the displays at the bottom right. Your Emacs session should be at the top left of your screen, and you should have just the tutorial showing in it initially. Then you press F4, starting A+ if necessary and displaying the A+ buffer below the tutorial buffer. When point in the A+ buffer (the location where the cursor would be if it were in that buffer) is not at the end of the file, the buffer does not scroll as you press F2 with the cursor in a line of the tutorial. Consequently, the current line in the A+ log will go off the bottom of the buffer and become invisible. To remedy this situation, move point to the end. One way to do this is to press R2, End, R2. Another way is to click the left mouse button with the pointer on the last line of the log and then to return by clicking with the pointer in the appropriate line of the tutorial; if the end of the log is not visible, click with the pointer anywhere in the log and press End, then return. Display Classes and Attributes The A+ screen management system, called s, includes twenty-four "display classes" in Version 2. These classes are intended for various purposes, and they display or use the values of various kinds of A+ variables or functions. The immediately obvious differences among them are in appearance. There are eight tutorials on the display classes, grouping ones that are similar, and treating separately the most elaborate one (graphs), the printing utility, and the variables that control defaults. All except the one on graphs are in the same directory as this introduction, (Install_Directory)/doc/tutorials By default the Install_Directory is /usr/local/aplus-fsf-x.xx (where x.xx is version.release) i.e. /usr/local/aplus-fsf-4.18/doc/tutorials Their names and their coverage are: * buttons, the classes showing arrays of buttons: action, button, check, and radio; * data, the classes for ordinary data display and, for some of them, input: array, label, matrix, page, slot, view; * menus, the classes showing menus, immediately or on request: choice, hmenu, vmenu; * containers, the classes which enclose other classes: hpane, layout, table, vpane, and window; * graph, an elaborate container class that deserves its own tutorial; * special_io, the classes for special text input of various kinds -- command, password, text -- and special kinds of display -- scalar, tree. * printing, the facilities that enable you to put an image of a display in a Postscript file, suitable for printing; * s_context_vars, the means for setting defaults. Associated with a displayed variable are "attributes", which play a very important role in s. They are set using the is and has functions and queried using the of function, as you will see in the Buttons tutorial. We can distinguish five typical kinds of attribute: * Attributes that are for reference only. Values cannot be specified for them; they can only be queried. * At the other extreme, attributes that are only triggers for action. Such an attribute triggers its action whenever any value is specified for it. Specifying the Null (no apparent value) or perhaps 1 for them might make your code as clear as possible; when you are setting only one attribute you can simply say `a has `attr. Some of the action attributes do not retain a value and cannot be queried. * Attributes that govern yes/no or on/off decisions. They effectively accept just boolean values, 1 and 0. For some of them, specifying the Null directs s to use the boolean value of an associated variable. * Attributes whose values are members of some well-defined set, such as left, right, top, bottom. * Attributes whose values lie in a range of numbers or are arbitrary text. Furthermore, an attribute can be * persistent, meaning that values can be specified and are retained when a variable is not bound to a display class; and, independently, * functional, meaning that a function can be specified for the attribute, not just a (data) value or a variable. Each individual attribute is discussed either in the tutorial on printing or with the first display class for which it is truly relevant or most general or useful for an example. If you want to review what was said about an attribute, or if you are not new to s and want to learn about a particular attribute, consult the following lists. They tell you where a discussion of it can be found: in which tutorials and, in the third list, which sections. In attributes for graphs, a leading x implies also X, y, and Y, or just X, when appropriate, and a leading y implies Y when appropriate. These attributes are discussed in the Graph tutorial: addtexttrace addtrace axis barwidth bottom coordinate Coordinate copytexttrace copytrace fillcolor footnote footnotefg footnotefont footnotejustify gradient grid gridfg gridstyle gridwidth left legend legendbg legendfg legendfont legendhlthickness legendshadowthickness legendstyle linecolor linestyle linewidth mode movelimit referpoint right rule rulewidth selectable selectdistance style subtitle subtitlefg subtitlefont subtitlejustify symbol symbolsize textactivate titlejustify top xaxis xextent xfg xinc xlabel xlabelfont xlabelheight xlabeljustify xlabelout xlabelwidth xleft xlegend xmajorticksize xmax xmin xminorticks xminorticksize xright xsublabel xsublabeljustify xsublabelout xtickstyle xtitle xtitlefg xtitlefont xtitlejustify yaxis ybottom ylabeljustify ylegend ymode ytitlestyle ytop zero zerofg zerostyle zerowidth The attributes discussed in the Printing tutorial are: print printbottom printdisbottommargin printdisfile printdisfont printdisleftmargin printdisorientation printdisrightmargin printdisrulewidth printdisstyle printdistopmargin printfile printfont printlayout printleft printmode printorientation printright printsize printtop The other attributes can be found in this list. Each is discussed in the tutorial named with it, in the display class whose initial is given after the name of the tutorial: acceptfocus: Containers l active: Data a ancestors: Containers l at: Containers l atsector: Buttons a b: Containers l bg: Buttons a blank: Data a blink: Data p blinkrate: Data p bold: Data p bound: Buttons a box: Data p boxcolor: Data p buffer: Special c build: Containers l C: Buttons a children: Containers l class: Buttons a clear: Data v col: Data a colindex: Data m colindexbg: Data m collabelrows: Data m color: Data p colormap: Data p colors: Data a cols: Data a colsep: Data a colspace: Data m copy: Data a cornerindex: Data m cornerindexbg: Data m cursor: Data c cycle: Data a def: Data a delete: Data a descendents: Containers l doc: Data a done: Data a dynamic: Data a edit: Data a editbg: Data a editfg: Data a editspace: Data a evaluate: Data a execute: Data a exit: Buttons a f1 - f12: Buttons a familytree: Containers l fg: Buttons a field: Containers t fields: Containers t fill: Special p firstcol: Data a firstfield: Containers t firstrow: Data a fixedfields: Containers t fkeys: Buttons a focus: Containers l followers: Buttons a followertree: Buttons a font: Containers t foot: Buttons a freeze: Containers l geometry: Buttons a h: Containers l H: Containers l head: Buttons a hide: Buttons a hl: Buttons a hlthickness: Buttons a hscrollbg: Data a hscrollsize: Data a icon: Buttons a iconic: Buttons a icontitle: Buttons a in: Data a index: Data a indexbg: Data a insertabove: Data a insertbelow: Data a is: Buttons a justify: Buttons a key: Data c keysym: Data p l: Containers l label: Buttons a labelfg: Buttons a labelfont: Buttons a leader: Containers l leftfoot: Buttons a line: Data p lockposition: Containers l locksize: Containers l lower: Buttons a mapped: Containers l margin: Buttons b na: Data a naturalsize: Buttons b, Data a newshow: Containers l notify: Data v out: Data a parent: Containers l pin: Buttons a position: Containers l preset: Buttons a primary: Data v protect: Data a protected: Containers t r: Containers l R: Buttons a raise: Buttons a rband: Data p rbandbox: Data p realize: Data a refer: Data a refresh: Data a reparent: Containers l request: Data v reshow: Containers l resize: Containers l resizeable: Buttons a respace: Data a rightfoot: Buttons a row: Data a rowbg: Data a rowindex: Data m rowindexbg: Data m rows: Data a rowsep: Data a save: Special t script: Buttons a scrollbg: Data a scrollsize: Data a select: Data a selectbg: Data a selectcol: Data m selectcorner: Data m selected: Buttons a selectedfield: Containers t selectfield: Containers t selectrow: Data m sensitive: Containers l set: Buttons a settings: Buttons a shadowthickness: Buttons a shell: Containers l shelltitle: Buttons a show: Buttons a size: Data a space: Data a stars: Data a state: Containers l stateself: Buttons a structure: Containers l t: Containers l tabfrom: Containers l tablist: Containers l tabto: Containers l 3down: Data p 3up: Data p title: Buttons a titledefine: Containers t titlefg: Buttons a titlefont: Buttons a 2down: Data p 2up: Data p underline: Data p valid: Special p validate: Special p vcol: Containers l vcols: Containers l verify: Buttons a vrow: Containers l vrows: Containers l vscrollbg: Data a vscrollsize: Data a w: Containers l W: Containers l ws: Buttons a x: Buttons a X: Containers l xs: Buttons a y: Buttons a Y: Containers l ys: Buttons a yx: Buttons a YX: Containers l yxs: Buttons a The savewm attribute has been removed.