[Next] [Previous] [Up] [Top] [Contents] [Index]

Windows and views

Creating a complex window

As noted above, it is possible to specify the attributes of a window when the window is created. The subviews can be part of these attributes. Combining the snippets of code we created in the Listener into a single function, we get the following. When this function is called, it displays a window containing a button and an editable-text dialog item. When the button is pressed, it retrieves the text from the editable-text dialog item and displays it in the Listener.
 (defun make-echo-window ()
   (make-instance 'window
     :window-title "Echo"
     :view-size #@(240 40)
     :view-subviews
     (list
      (make-instance 'button-dialog-item
        :dialog-item-text "Echo"
        :dialog-item-action 
        #'(lambda (button)
            (let* ((text-item (view-named 'visitor button))
                   (text (dialog-item-text text-item)))
              (format t text))))
      (make-instance 'editable-text-dialog-item
        :view-size #@(160 16)
        :view-nick-name 'visitor))))

Gettmg Started with MCL - 19 OCT 1996
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker