Important: The information in this document is obsolete and should not be used for new development.
LNew
You can use theLNewfunction to create a new list in a window.
FUNCTION LNew (rView, dataBounds: Rect; cSize: Point; theProc: Integer; theWindow: WindowPtr; drawit, hasGrow, scrollHoriz, scrollVert: Boolean) : ListHandle;
rView- The rectangle in which to display the list, in local coordinates of the window specified by the
theWindowparameter. This rectangle does not include the area to be taken up by the list's scroll bars.dataBounds- The initial data bounds for the list. By setting the
leftandtopfields of this rectangle to (0,0) and therightandbottomfields to (kMyInitialColumns,kMyInitialRows), your application can create a list that haskMyInitialColumnscolumns andkMyInitialRowsrows.cSize- The size of each cell in the list. If your application specifies (0,0) and is using the default list definition procedure, the List Manager sets the
vcoordinate of this parameter to the sum of the ascent, descent, and leading of the current font, and it sets thehcoordinate using the following formula:cSize.h := (rView.right - rView.left) DIV (dataBounds.right - dataBounds.left)
theProc- The resource ID of the list definition procedure to use for the list. To use the default list definition procedure, which supports the display of unstyled text, specify a resource ID of 0.
theWindow- A pointer to the window in which to install the list.
drawIt- A Boolean value that indicates whether the List Manager should initially enable the automatic drawing mode. When the automatic drawing mode is enabled, the List Manager automatically redraws the list whenever a change is made to it. You can later change this setting using the
LSetDrawingModeprocedure. Your application should leave the automatic drawing mode disabled only for short periods of time when making changes to a list (by, for example, adding rows and columns).hasGrow- A Boolean value that indicates whether the List Manager should leave room for a size box. The List Manager does not actually draw the grow icon. Usually, your application can draw it with the Window Manager's
DrawGrowIconprocedure.scrollHoriz- A Boolean value that indicates whether the list should contain a horizontal scroll bar. Specify
TRUEif your list requires a horizontal scroll bar; specifyFALSEotherwise.scrollVert- Indicates whether the list should contain a vertical scroll bar. Specify
TRUEif your list requires a vertical scroll bar; specifyFALSEotherwise.DESCRIPTION
TheLNewfunction attempts to create a list defined by the function's parameters and returns a handle to the newly created list. If theLNewfunction cannot allocate the list,
it returnsNIL. This might happen if there is not enough memory available or ifLNewcannot load the resource specified by thetheProcparameter. If theLNewfunction returns successfully, then all of the fields of the list record referenced by the returned handle are correctly set.If the list contains a horizontal or vertical scroll bar and the window specified by the parameter
theWindowis visible,LNewdraws the scroll bar for the new list in the window just outside the list's visible rectangle specified by therViewparameter. TheLNewfunction does not, however, draw a 1-pixel border around the list's visible rectangle.SPECIAL CONSIDERATIONS
You should not call theLNewfunction from within an interrupt, such as in a completion routine or VBL task.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theLNewfunction are
Trap macro Selector _Pack0 $0044 SEE ALSO
See Listing 4-1 on page 4-18 for an example of how to use theLNewfunction.