background image
C H A P T E R 3
Views
3-10
About Views
Handling Pen Input
3
The use of the
vClickable viewFlags
constant to control pen input is
important to understand, so it is worth covering here, even though it is discussed in
more detail in "Recognition" (page 9-1). The
vClickable
flag must be set for a
view to receive input. If this flag is not set for a view, that view cannot accept any
pen input.
If you have a view whose
vClickable
flag is not set, pen events, such as a tap,
will "fall through" that view and be registered in a background view that does
accept pen input. This can cause unexpected results if you are not careful. You
can prevent pen events from registering in the wrong view by setting the
vClickable
flag for a view and providing a
ViewClickScript
method in the
view that returns non-
nil
. This causes the view to capture all pen input within
itself, instead of letting it "fall through" to a different view. If you want to capture
pen events in a view but still prevent input (and electronic ink), do not specify any
other recognition flags besides
vClickable
.
If you want strokes or gestures but want to prevent clicks from falling through up
the parent chain, return the symbol
'skip.
This symbol tells the view system not
to allow the stroke to be processed by the parent chain, but instead allows the
stroke to be processed by the view itself for recognition behavior.
Several other
viewFlags
constants are used to control and constrain the recognition
of text, the recognition of shapes, the use of dictionaries, and other input-related
features of views. For more information, refer to "Recognition" (page 9-1).
Location, Size, and Alignment
3
The location and size of a view are specified in the
viewBounds
slot of the view
template. The
viewJustify
slot affects the location of a view relative to other
views. The
viewJustify
slot also controls how text and pictures within the view
are aligned and limits how much text can appear in the view (one line, one word,
and so on).
The
viewOriginX
and
viewOriginY
slots control the offset of child views
within a view.
View Bounds
3
The
viewBounds
slot defines the size and location of the view on the screen. The
value of the
viewBounds
slot is a frame that contains four slots giving the view
coordinates (all distances are in pixels). For example:
{left:
leftValue
,
top:
topValue
,
right:
rightValue
,
bottom:
bottomValue
}
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна