background image
C H A P T E R 4
NewtApp Applications
Using NewtApp
4-15
Optional. Set the
statusBarSlot
to contain the declared name of the status
bar so layouts can use it to control the buttons displayed on it. Use the symbol
'status
to set it.
If you wish to override a system message like
ViewSetupFormScript
, which is
called before a view is displayed on the screen, make sure to call the inherited
method at the end of your own
ViewSetupFormScript
method. Also, you may
wish to add a
ReOrientToScreen
method to the
newtApplication
base
view so your application can rotate to a landscape display. This message is sent to
each child of the root view when the screen orientation is changed. See
ReOrientToScreen
(page 2-73) in Newton Programmer's Reference for details.
Finally, be sure to add the layout file
baseView.t
to your project and mark it as
the application base view.
Tying Layouts Into the Main Application
4
The
allLayouts
slot in the
newtApplication
proto is a frame that contains
symbols for the application's layout files. It must contain two slots, named
default
and
overview,
that refer to the two layout files used for those
respective views.
The section "Using the Layout Protos," beginning on page 4-16, shows how to use
the NewtApp layout protos to construct these files. Assume they are named Default
Layout and Overview Layout for the purpose of setting the references to them in
the
allLayouts
slot. The following code segment sets the
allLayouts
slot
appropriately:
allLayouts:= {
default: GetLayout("Default Layout"),
overview: GetLayout("Overview Layout"),
}
Setting Up the Application Soup
4
The
newtApplication
proto uses the values in its
allSoups
slot to set up and
register your soup with the system.
The framework also looks in the
allSoups
slot to get the appropriate
soup information for each layout. It does this by matching the value of
the layout's
masterSoupSlot
to the name of a frame contained in the
newtApplication.allSoups
slot. See the section "Using the Layout Protos,"
following this one.
This application contains only one soup, though a NewtApp application can
contain more than one. Each soup defined for a NewtApp application must be
based on the
newtSoup
proto. The slots
soupName
,
soupIndices
, and
soupQuery
must be defined within the
allSoups
soup definition frame.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна