(in-package "COMMON-LISP-USER")
;;; Example dialog as taken from the ACL-PC 3.0.2 on-line documentation

(defconstant request-dialog-items	;a list of dialog items

   (list 
      (make-dialog-item          ;a button which is named "OK" and
         :widget 'button         ;has a value function which is 
         :title :ok              ; set up so that clicking in the
         :box (make-box 18 80 89 100)	
                                 ;button terminates the dialog 
         :set-value-fn           ;interaction 
          #'(lambda (&rest args) 
               (values t t))) 
      (make-dialog-item                ;a static text item which is used 

         :widget 'static-text          ;to display a prompt
         :value "Please type in a filename:" 
         :box (make-box 18 12 306 26))
      (make-dialog-item               ;an editable text item which is 
         :widget 'editable-text       ;where the user types the new 
         :title nil                   ;filename. Initially the filename 
         :value ""                    ;is blank 
         :box (make-box 18 34 306 60))))

(setf *a-request-dialog*        ;store the dialog stream in a

      (open-dialog              ;special variable 
         request-dialog-items 
         'dialog                    ;this is the device manager 
         *screen*                   ;this is the location 
         :pop-up-p t
         :title "Filename Request" 
         :window-interior                ;opening a pop-up dialog does 
           '#.(make-box 62 89 386 195))) ;not display it.

(defun ask-user-for-filename (initial-name) 
   (set-dialog-item-value        ;set the initial name to be

      (third                     ;displayed 
         (dialog-items *a-request-dialog*))
      initial-name) 
   (pop-up-dialog *a-request-dialog*);the dialog interaction 
   (dialog-item-value
      (third                                    ;return the filename as edited 

         (dialog-items *a-request-dialog*))))   ;by the user.