NTK Reference
GetLayout
compile-time call provides a way to obtain a reference to another template. Linked Layouts provide a way to have a layout as a child template (as part of the stepChildren
slot). GetLayout
provides a more general mechanism allowing you to save a layout in any slot.
Here's an example from the allLayouts
slot of a newtApplication:
{ default: GetLayout("Default.t"), overview: GetLayout("Overview.t"), }This creates a frame with two slots in it. The
default
slot holds the topmost template in the "Default.t" layout. Similarly, the overview
slot holds the topmost template in the "Overview.t" layout.
During the build process, when the compiler sees a call to GetLayout
, it checks the specified file to see whether it has already been processed during this build. If it has, it replaces the call to GetLayout
with the topmost template from the processed layout. If not, it generates an error (see FIGURE A.15). Therefore, make sure that layouts you reference with GetLayout
appear earlier in build order than the file containing the call to GetLayout
. Use the Process Earlier or Process Later menu items to change the build order.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996