Finding the bounds of views 3 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 123

Advertising
background image

C H A P T E R 3

Views

Using Views

3-39

Typically, modal views are used for slips. For example, if the user was going to
delete some data in your application, you might want to display a slip asking them
to confirm or cancel the operation. The slip would prevent them from going to
another operation until they provide an answer.

Use

AsyncConfirm

to create and display a slip that the user must dismiss before

continuing. The slip is created at a deferred time, so the call to

AsyncConfirm

returns immediately, allowing the currently executing NewtonScript code to finish.
You can also use

ModalConfirm

but this method causes a separate OS task to be

created and doesn’t return until after the slip is closed. It is less efficient and takes
more system overhead.

Once you’ve created a modal view, you can use the

FilterDialog

or

ModalDialog

to open it. Using

FilterDialog

is the preferred method as it

returns immediately. As with

ModalConfirm

,

ModalDialog

causes a separate

OS task to be created.

Finding the Bounds of Views

3

The following functions and view methods calculate and return a

viewBounds

frame.

Run-time functions:

RelBounds

— calculates the right and bottom values of a view and returns a

bounds frame.

SetBounds

—returns a frame when the left, top, right, and bottom coordinates

are given.

GlobalBox

—returns the rectangle, in coordinates, of a specified view.

GlobalOuterBox

—returns the rectangle, in coordinates, of a specified view

including any frame that is drawn around a view.

LocalBox

—returns a frame containing the view bounds relative to the view itself.

MoveBehind

— moves a view behind another view.

DirtyBox

— marks a portion of a view as needing redrawing.

GetDrawBox

— returns the bounds of an area on the screen that needs redrawing.

Compile-time functions:

ButtonBounds

—returns a frame when supplied with the width of a button to

be placed in the status bar.

PictBounds

— finds the width and height of a picture and returns the proper

bounds frame.

Advertising