Arguments: owner dialog return-position
This generic function is called internally when one of the following Common Graphics functions is called. They all invoke a utility dialog written in lisp.
pop-up-message-dialog, ask-user-for-choice, ask-user-for-choice-from-list, ask-user-for-string, pop-up-string-dialog, pop-up-strings-dialog, y-or-n-dialog, yes-no-or-cancel-list, ask-save-changes.
The default method is shown below. It calls center-modal-children. Programmers may override the default if desired.
The owner argument is the window or screen that was passed as the value of the stream argument to the utility function to serve as the owner of the dialog. The dialog argument is the dialog that is being invoked. The return-position argument is a position that the method should modify and return (or it may return another position object). The dialog will then be positioned with its upper-left corner at this returned position. The position should be in screen coordinates.
This function is not called for Common Dialogs since there is no Common Graphics window object to position. The only way to position a Common Dialog is to move the owner window before invoking the dialog; the Common Dialog will then typically appear with its upper left corner at or near the upper left corner of the owner window that is passed to the utility dialog function. (See center-all-modal-dialogs-on-screen.)
Here is the default method. An application could add a method to override this default in order to position the Common Graphics utility dialogs in some arbitrary way. When this function is called, the dialog already has the width and height at which it will appear, so the method can use that information to position the dialog.
(defmethod position-utility-dialog ((owner t)(dialog t) return-position) ;; A user-overridable generic function. Should modify ;; return-position to contain the screen position for the dialog ;; and return it the position (let* ((exterior (exterior dialog)) (width (width exterior)) (height (height exterior)) (owner-box (interior owner))) (case (center-modal-children owner) (:on-owner (window-to-screen-units owner (nmake-position return-position (floor (- (box-width owner-box) width) 2) (floor (- (box-height owner-box) height) 2)))) ((nil) (let* ((margin (modal-dialog-margin (configuration *system*)))) (window-to-screen-units owner (nmake-position return-position margin margin)))) (t (let* ((box (center-box-on-screen width height))) (nmake-position return-position (box-left box)(box-top box)))))))
Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.
The documentation is described in introduction.htm and the index is in index.htm.
Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.