background image
C H A P T E R 8
Text and Ink Input and Display
8-8
Using Text
Here is an example of a template defining a view of the
clEditView
class:
editor := {...
viewClass: clEditView,
viewBounds: {left:0, top:0, right:200, bottom:200},
viewFlags: vVisible+vAnythingAllowed,
viewFormat: vfFillWhite+vfFrameBlack+vfPen(1)+
vfLinesLtGray,
viewLineSpacing: 20,
// methods and other view-specific slots
viewSetupFormScript: func()...
...}
System Messages in Automatically Created Views
8
When a child view is automatically created by a
clEditView
, the
vNoScripts
flag is set in the
viewFlags
slot of the child view. This flag prevents system
messages from being sent to a view.
This behavior is normally desirable for automatically created views, because they
have no system message-handling methods and the system saves time by not
sending the messages to them.
If you want to use one of these views in a manner that requires it to receive system
messages, you need to remove the
vNoScripts
flag from the
viewFlags
slot of
the view.
Creating the Lined Paper Effect in a Text View
8
A view of the
clEditView
class can appear simply as a blank area in which the
user writes information. However, this type of view usually contains a series of
horizontal dotted lines, like lined writing paper. The lines indicate to the user that
the view accepts input. To create the lined paper effect, you must set the following
slots appropriately:
viewFormat
Must include one of the
vfLines...
flags. This activates the
line display.
viewLineSpacing
Sets the spacing between the lines, in pixels.
viewLinePattern
Optional. Sets a custom pattern that is used to draw the lines
in the view. In the
viewFormat
slot editor in NTK, you
must also set the Lines item to Custom to signal that
you are using a custom pattern. (This sets the
vfCustom<<vfLinesShift
flag in the
viewFormat
slot.)
Patterns are binary data structures, which are described in the
next section.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна