FunctionPackage: common-graphicsToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.2
Unrevised from 6.1

default-init-function

Arguments: nil

default-init-function is the default on-initialization function for a project. It creates and displays the running window for the main form of the project, and then returns that window so that the application will exit when the main window is closed.

Below is the complete code for this function, which an application may model after if it needs to use a custom on-initialization function.

(defun default-init-function ()
  (let* ((main-module (main-module (current-project)))
         window)
    
    ;; This default on-initialization function expects the
    ;; project to have a main form to run.  For a project
    ;; that uses no windows at all, you would need to substitute 
    ;; a different on-initialization function.
    (unless main-module
      (error "The project has no main form to run.  Either add a form ~
                 to the project or give the project a different ~
                 on-initialization function."))
    
    ;; Call the main form module's maker-function to create its window.
    (setq window (funcall (maker-function main-module) 
                          
                          ;; Run the main form on the screen (rather than in 
                          ;; the IDE on the development-main-window where
                          ;; individual forms are run) to emulate a completely
                          ;; independent standalone application.
                          :owner (screen *system*))) 
    
    ;; Cache the main window so that its finder function will
    ;; find it later.
    (add-application-window window)
    
    ;; Select the window if needed so that the end user sees it.
    ;; A custom on-initialization function might want to customize
    ;; the window contents in some way before revealing it here.
    (when (and window
               (eq (state window) :shrunk))
      (select-window window))
    
    ;; Return the main window of the application, to tell the application
    ;; to exit whenever this window becomes closed.
    window))

Copyright (c) 1998-2002, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 6.2. This page was not revised from the 6.1 page.
Created 2002.2.26.

ToCDocOverviewCGDocRelNotesIndexPermutedIndex
Allegro CL version 6.2
Unrevised from 6.1