DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Programming tips and known problems

Menus

The precise rules for how rows and columns are determined in menus are given in the following table. This table should only be needed in exceptional cases (for example, when a developer has coded ``unreasonable'' values for the rows and columns descriptors in a menu definition file). In general, the number of columns in a menu is determined before the number of rows, and columns specified with the columns descriptor takes precedence if there is a conflict with the number of rows requested. The number of rows is usually the minimum of the three variables aR (available rows), sR (specified rows), and nR (needed rows).

The table entries for the two cases when columns is specified and description is not imply that menu items are truncated to fit in the column size determined from sC. Thus, the columns descriptor should not be specified for menus that are dynamically generated, when there is no way to guarantee that such a menu will not have truncated items.

Descriptors set? step 1 step 2 step 3
d r c pC pR uC uR
yes no no not needed not needed 1 min(10,nR)
yes no yes " " 1* "
yes yes no " " 1 min(aR,nR,sR)
yes yes yes " " 1* "
no no no --** --** --** --**
no no yes if sC > mC, 1;
otherwise, sC***
((tI-1) mod pC)+1 if pR > aR, 1:
otherwise, pC
if pR > aR,
min(aR,10);
otherwise, pR
no yes no ((tI-1) mod pR)+1+ min(aR,nR,sR)+ if pC > fC, 1;
otherwise, pC
pR
no yes yes if sC > mC, 1;
otherwise, sC***
((tI-1) mod pC)+1 if pR > aR, 1;
otherwise, pC
if pR > aR,
min(aR,sR);
otherwise, pR++
Footnotes


*
columns descriptor is ignored

**
the algorithm attempts to open a menu with a 3:1 aspect ratio of width to height

***
menu items are truncated if they are too long to fit; equal-width columns are kept after truncation

+
step 1 and step 2 are reversed for this case (pR must be computed first)

++
rows descriptor is ignored

Legend


d
description descriptor

r
rows descriptor

c
columns descriptor

sR
(specified rows) the value coded with the rows descriptor

aR
(available rows) the number of rows that frames can occupy on the terminal screen

nR
(needed rows) the number or rows needed to open the menu--for single-column menus this equals tI

pR
(probable rows) the number of rows needed to open the menu, as determined from the first (preliminary) calculations

uR
(used rows) the number of rows used to open the menu, after all steps are done

tI
(total items) the total number of menu items for the menu (the number of menu descriptors)

sC
(specified columns) the value coded with the columns descriptor

fC
(fittable columns) the number of columns that can fit on the screen, given the screen width and the length of the longest menu item; equals (screenWidth-2) mod (maxItemWidth+1); this is a ``maximum'' value--the maximum fittable columns

mC
(max columns) the maximum number of columns that could fit on the screen if each column were only 1 character wide; equals (screenWidth-3) mod 2

pC
(probable columns) the number of columns needed to open the menu, as determined from the first (preliminary) calculations

uC
(used columns) the number of columns used to open the menu, after all steps are done

Next topic: Text
Previous topic: Forms

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004