Previous | Next

Overview

Quick Start

Applescript

Download

Licensing

Revisions

Future Directions

I

Quick Start

For most purposes WTextView will be part of a view hierarchy that is designed in Constructor. A custom CYTP resource is provided in the WasteDemo.ppob file that defines the fields for WTextView. Most of these are concerned with the feature flags of the WASTE view. Creating a WTextView for your application involves 4 steps, design your user interface in Constructor, add the WASTE and WTextView source code to your application, add required libraries, and register your classes.

Design your user interface

WTextViews can be added like any other view in constructor. Just make sure the custom CYTP resource is open. The resource is part of WasteDemo.ppob so if you want to use it in other PPob resources be sure to copy it or better yet add it to your custom types folder. Open up the catalog window (Window->Catalog). Click on the View tab at the top of the window. The WasteView should be at the bottom of the window. Drag WasteView from the Catalog window onto the window or dialog that you are constructing. Set the options for the waste view. The options include

  • Selectable - If checked, text can be selected in the view.

  • Word Wrap - Wrap text to the width of the view.

  • Use Tab Support - Enable WASTE tab support (not yet implemented in WASTE 2.0)

  • Use Margins - Make the WTextView aware of the margins between it and its parent view. This is useful for drawing a background color other than white in the margin.

  • Activate/Deactivate Scroller - If checked, activate the owning LScrollerView (if WTextView is in one) when the view becomes the target and deactivate the scroller if the view is no longer the target.

  • Text Traits - The ID of the text traits for this view. You can define font, color, size, style and justification for the initial text

  • Initial Text Resource - The ID of the a 'TEXT' resource that contains default text to place in the view. It is also possible to include 'styl' and 'SOUP' resources with the same ID as the initial 'TEXT' resource.

  • WASTE feature flags - The user modifiable features of WASTE. See WASTE for explanations.

  • Background Color - The color of the background for the view.

Add the WASTE and WTextView Source

The following WASTE code is added to the demo version project. I, Timothy Paustian, created the project using the document stationary for Power Plant.

WEAccessors.c
WEBirthDeath.c
WEDebug.c
WEDrawing.c
WEFontTables.c
WEHighLevelEditing.c
WEICGlue.c
WEInlineInput.c
WELineLayout.c
WELongCoords.c
WELowLevelEditing.c
WEMouse.c
WEObjects.c
WEScraps.c
WESelecting.c
WESelectors.c
WEUndo.c
WEUnicode.c
WEUserSelectors.c
WEUtilities.c
waste.h
InternetConfig.h

NOTE: Waste 2.0 is distributed in library form, unless you buy a source license. You can just include the WASTE library, not all the WASTE source .c files, as above.

The PPlant wrapper consists of two classes WText and WTextView. These are the only required for WASTE. To implement the Apple Script text model, the WTextModel classes have to be added. See Adding Apple Script support to WASTE for more details.

Add the required libraries

The following libraries also have to be added to the project for WASTE

UnicodeConverter - For Unicode support

TextCommon - For Unicode support

Register your classes

During application startup, don't forget to register WTextView. Add this line of code during other class registration.

RegisterClass_(WTextView);

Take a look at the NThisAppRegistry is included that registers the applications views.

Hit compile to make the project and you're set. Enjoy!

Originally by Timothy Paustian. Last modified September 17, 2002. Contact David Phillip Oster <mailto:oster@ieee.org>.