Title Banner

Previous Book Contents Book Index Next

Newton Developer Technical Information: Newton Programmer's Guide: 2.1 OS Addendum /
Chapter 3 - Word Processing Views / Using Word Processing Views


Initializing Your Word-Processing View

You can initialize your word-processing view in the ViewSetupFormScript method. The TXWord implementation of this method calls the inherited ViewSetupFormScript method and then initializes the store, as shown in Listing 3-1.

Listing 3-1 Initializing a word-processing view

ViewSetupFormScript:

func() begin inherited:?ViewSetupFormScript(); // store data in a VBO, not in NewtonScript memory :SetStore(GetDefaultStore()); // cache box top value for use in GetTextHeight method self.ourGlobalBoxTopCoordinate := :GlobalBox().top; constant kMaxScrollHeight := 32767; :SetGeometry(true, :localbox().right, kMaxScrollHeight, Relbounds(0,0,0,0)); end

The *protoTXView:*SetStore method, which is called in the TXWord program's ViewSetupFormScript method, specifies which store is used to contain the text edited in your word-processing view. This is normally the same as your soup entry's store. You can (as TXWord does) call the GetDefaultStore function to retrieve the default store and use that.

The TXWord ViewSetupFormScript method sets the scroll height to a very large number (32767), which ensures that the user can see all of the text. Note that this is used for a non-paged view; if you specify a paged view in your *SetGeometry call (true as the value of the first argument), you must specify the actual size of an individual page as the scroll height value.

Although TXWord does not use margins, it still must provide a margins rectangle frame as the last parameter in the call to *SetGeometry. The call to Relbounds returns a rectangle frame.

Note
You can call the *SetStore method of your word-processing view only once, and you must call it while the view is being created (before the ViewSetupDoneScript method is called). If you do not call *SetStore, your text defaults to being RAM based.

Setting Up Your Word-Processing View

You can initialize your word-processing view with the current document by reading the document data from your soup after the view has been completely set up. The TXWord program initializes its view in the ViewSetupDoneScript method, as shown in Listing 3-2.

Listing 3-2 Setting up a word-processing view

ViewSetupDoneScript:

func() begin :SetupScrollers(); :GetSoupData(); SetKeyView(self, 0); inherited:?ViewSetupDoneScript(); end

The TXWord implementation of ViewSetupDoneScript calls the following four methods:


Previous Book Contents Book Index Next

© Apple Computer, Inc.
26 APR 1997



Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help