Apple Newton Utilities Uživatelská příručka Strana 96

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 942
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 95
CHAPTER 3
Views
3-12 About Views
View Size Relative to Parent Size 3
A view is normally entirely enclosed by its parent view. You shouldn’t create a
view whose bounds extend outside its parent’s bounds. If you do create such a view,
for example containing a picture that you want to show just part of, you need to set
the
vClipping ag in the viewFlags slot of the parent view.
If you do not set the
vClipping ag for the parent view, the behavior is
unpredictable. The portions of the view outside the parent’s bounds may or may
not draw properly. All pen input is clipped to the parent’s bounds.
Note that the base views of all applications (all root view children, in fact) are
automatically clipped, whether or not the
vClipping ag is set.
If your application base view is very small and you need to create a larger oating
child view, for example, a slip, you should use the
BuildContext function. This
function creates a special view that is a child of the root view. To open the view,
you send the
Open message to it.
Using Screen-Relative Bounds 3
Newton is a family of products with varying screen sizes. If you want your
application to be compatible with a variety of individual Newton products, you
should design your application so that it sizes itself dynamically (that is, at run
time), accounting for the size of the screen on which it is running, which could be
smaller or larger than the original Newton MessagePad screen.
You may want to dynamically size the base view of your application so that it
changes for different screen sizes, or you may want it to remain a xed size on all
platforms. In the latter case, you should still check the actual screen size at run
time to make sure there is enough room for your application.
You can use the global function
GetAppParams to check the size of the screen at
run time. This function returns a frame containing the coordinates of the drawable
area of the screen, as well as other information (see “Utility Functions Reference”
(page 23-1) in the Newton Programmers Reference for a description). The frame
returned looks like this:
{appAreaLeft: 0,
appAreaTop: 0,
appAreaWidth: 240,
appAreaHeight: 320,
...}
The following example shows how to use the ViewSetupFormScript method in
your application base view to make the application a xed size, but no larger than
the size of the screen:
Zobrazit stránku 95
1 2 ... 91 92 93 94 95 96 97 98 99 100 101 ... 941 942

Komentáře k této Příručce

Žádné komentáře