Le Club Macintosh de MontrƯal Publication: InterFace Issue: Unknown Author: John Markle Series: None Title: NeXT Programming ------------------------------------ NeXT Programming John Vincent Markle Welcome to the NeXT Programming column, which is intended to complement the NeXT Programming SIG which is held on the last Thursday of each month; three SIG meetings have been held so far, each of them quite lively and interesting. Since I have been waiting for the arrival of Release 2.0 before beginning this column, it is therefore appropriate that this first article should address some of the additions and changes to the various object Kits and the Interface Builder itself. Application Kit Several new object classes are now supported in Release 2.0. The Bitmap class has been replaced with the NXImage class which can cache images in off-screen windows and display them on-screen through compositing, can deal with color images, can load images from EPS files, and can store multiple representations of the same image and choose the best depending on the output device. Two new classes, NXBrowser and NXBrowserCell, allow the user to browse through hierarchical information. Event journaling has been added with the NXJournaler class. A new class, NXSplitView, supports sharing screen space between two views. The Pasteboard class has been generalized to allow for additional named Pasteboards, beyond the standard one used for cut, copy and paste. The PopUpList class enables the user to display all the menu items within a pop-up list by simply double-clicking on it. A new type has been added, NXColor, which allows treating color as one single element; all Kit objects use NXColor to set/get color values. Basic functions provide for mapping between color components (RGB, RGBA, HSBA and CMYKA) and NXColor values, and vice versa. In addition, two new classes, NXColorPanel and NXColorWell, have been added to choose colors. The Text object now allows you to put views and cells into the text stream. These views and cells can implement graphics or animations, and behave like large characters in the text. As well, a new checkSpelling: method searches the text starting at the current selection looking for a misspelled word, and a new showGuessPanel: method brings up a panel which has guesses for the currently selected misspelled word. A new Application object method, faxPSCode:, allows the application to "print" to a Fax modem. For backward compatibility, the PrintPanel has a Fax button on it which brings up the same panel as faxPSCode: does. That way, 1.0 applications can get the ability to Fax without adding a new command which calls faxPSCode: directly. A new inter-application communication facility has been added to the Application Kit. A mechanism has been added (the Services menu) for applications to publish any services which they are willing to provide to other applications making it possible for applications which want to have Services menus to be completely ignorant of the services provided when they are developed. Applications which want to be able to make requests of other applications must place a Services menu item in their main menu (they need not put anything in the menu, it simply must exist). Finally, for the real space cadets, there is a new Subprocess class which facilitates the management of concurrent, asynchronous UNIX processes within a NeXTstep application. Methods are provided for the creation, termination and communication (via delegation) with the underlying UNIX process. In addition to providing a controlled NeXTstep interface to standard UNIX utilities, a Subprocess object can also provide, on request, the environment necessary for UNIX processes requiring pseudo terminal (or pty) support. Common Classes A new common object class, NXStringTable, associates a key with a value, both of which must be character strings. By using an NXStringTable object to store your application's character strings, you can reduce considerably the effort required to adapt the application to different language markets. To complement this object, a new Application object method, systemLanguages, lets you get the natural languages the user speaks and a new function, NXOrderStrings(), returns the proper ordering of two strings based on tables which can be localized for different languages. It should be noted that the other four common classes, which are only documented on-line, are extremely useful as well. These are Storage, List, HashTable and StreamTable. NIKit The NIKit is a new interface provided for access to NetInfo domains, and represents the alpha release of a minimal set of tools for use in administrative applications. The NIKit consists of five basic objects: NIDomain, NILoginPanel, NIDomainPanel, NIOpenPanel and NISavePanel. The fist object is an interface to open and read information from a NetInfo domain, and the next four are panels to navigate and identify the user to various NetInfo domains. Interface Builder Interface Builder's menus have been revised to reflect the user interface guideline changes for the 2.0 release, with the Format and Services commands having been added to the main menu. The Palettes window has been reorganized and expanded to now include four palettes: Menus, Windows, Basic Views, and Scrolling Views. The Menus palette now provides a greater number of common menu items, including Windows, Services, and Color Panel. The standard Info panel, which in the 1.0 release was automatically provided with each new application, is now an item in the Windows palette. An NXColorWell object and a PopUpList have been added to the Basic Views palette. The new Scolling Views palette contains an NXBrowser object and a ScrollView containing a Text object. Interface Builder now lets you create four different types of projects: Application, the standard project type which hasn't changed in the 2.0 release; Custom IB, which lets you build a custom version of Interface Builder; IB Palette, which lets you create a palette file; and, Subproject, which is useful as a way to group files in large projects having numerous source files. The Attributes display now includes Make Options and File Package choices. Make Options sets whether the Make command in Interface Builder's File menu causes a make or a make debug command to be executed. The File Package option determines whether the project is built and installed as a file package wherein your project's executable file, its interface files, and any other associated files are kept as separate files. As an advanced feature, Interface Builder now lets you reorder the listing of source files within the Project inspector's Files display. Since the listed order of the source files determines the order in which the object modules are linked into the final executable file, this feature can help you improve the locality of reference, and thus the performance, of your application. In Release 1.0, you had to provide a method to set each outlet that you declared in a new class. In Release 2.0, these outlet initialization methods are no longer required, thereby reducing the clutter in your source code. At run time, when objects are being unarchived and initialized, the system will send a message to an object to set its outlet, assuming the object can respond to such a message; if not, the system sets the object's outlet directly. Summary The NeXT development environment is much richer in Release 2.0, with each of the changes and additions complementing or extending the environment in a useful fashion. Obviously, the people at NeXT have been listening to developers and have responded to their needs. Good news for future SIG meetings! There are new folders on the system which will complement the existing system documentation: the /NextDeveloper/Examples folder contains 3.7 MB of code covering 29 separate examples, and the /NextLibrary/Documentation/NextAnswers folder contains 2.7 MB of questions and answers on a broad range of NeXT topics. In addition, the Digital Librarian now provides searching capabilities to 3.0 MB of technical documentation.