background image
C H A P T E R 8
Text and Ink Input and Display
Using Text
8-35
Key Dimensions
8
The width and height of keys are specified in units, not pixels. A key unit is not a
fixed size, but is used to specify the size of a key relative to other keys. The width
of a unit depends on the total width of all keys in the view and on the width of the
view itself. Key widths and heights can be specified in whole units, half units,
quarter units, and eighth units.
When it is displayed, the whole keyboard is scaled to fit entirely within whatever
size view bounds you specify for it.
To fit the whole keyboard within the width of a view, the total unit widths are
summed for each row, and the scaling is determined based on the widest row. This
row is scaled to fit within the view width, giving an equal pixel width to each
whole key unit. A similar process is used to scale keys vertically to fit within the
height of a view.
Fractional key units (half, quarter, eighth), when scaled, must be rounded to an
integer number of pixels, and thus may not be exactly the indicated fraction of a
whole key unit. For example, if the keys are scaled to fit in the view bounds,
a whole key unit ends up to be 13 pixels wide. This means that a key specified to
have a width of 1 3/8 units (
keyHUnit+keyHEighth*3
) is rounded to 13 + 5, or
18 pixels, which is not exactly 1 3/8 *13.
keyFramed
Specify the thickness of the frame around the key. Multiply
this constant by the number of pixels that you want to use
for the frame thickness, from 0-3.
keyRoundingUnit
Specify the roundedness of the frame corners. Multiply this
constant by the number of pixels that you want to use for
the corner radius, from 0-15, zero being square.
keyLeftOpen
No frame line is drawn along the left side of this key.
keyTopOpen
No frame line is drawn along the top side of this key.
keyRightOpen
No frame line is drawn along the right side of this key.
keyBottomOpen
No frame line is drawn along the bottom side of this key.
keyHUnit
keyHHalf
keyHQuarter
keyHEighth
A combination of these four constants specifies the
horizontal dimension of the key in units. For details,
see the next section.
keyVUnit
keyVHalf
keyVQuarter
keyVEighth
A combination of these four constants specifies the
vertical dimension of the key in units. For details, see
the next section.
Table 8-8
Key descriptor constants (continued)
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна