CLIM mail archive


Selecting Objects in Clim output menu

I am new CLIM user and am faced with a problem I cannot figure out.
I am using:
    CLIM 1.0 under Genera 8.1.1 (8640)
    CLIM 1.1 under Lucid 4.0.2 (Sparcstation)
    CLIM 1.1 under CLOE 4.0 (MS-DOS 5.0)

The problem is that I cannot seem to make an object selectable
on a CLIM menu. The program uses clim:define-application-frame
to generate the main menu (with its own command-table). I have
been able to have the user select from available options, then
using popup-menus refine the appropriate action, and finally
using clim:define presentation-method print out the results to
a clim window (generated through clim:open-window-stream).
(subset of code given below.) When the results have been printed,
the user should have the option of selecting directly from one
of formated objects (for example, if print out a contract, one of
the items printed is the route it is scheduled on, thus I would
like the route object to be selectable and print out that route's
information), or return to the main menu and select a different
(top-level action). Currently, only the latter has been achieved.
I have used clim:define-command and clim:define-presentation-to-
command-translator (as well as the formating function). However,
I cannot get the items in the "result" window to be selectable.
(I have tried using the same command table as well as different
command tables for the main menu and output window).




;;; -*- Mode: LISP; Syntax: Common-lisp; CLOE: Yes; Package: CSSF -*-

;;; File:                    Author: BJM           Created: 3/16/92
15:14:22 ;;;
;;; Copyright 1992 United Technologies Corporation,  Unpublished
Work        ;;;
;;;  PTW [Apr 12,1992] - modifications for clim begun

(in-package :CSSF)

(clim:define-application-frame ISMA (clim:application-frame)
  (:panes ((isma-menu :command-menu)
	   (isma-interaction :interactor :end-of-line-action :wrap
			     :end-of-page-action :scroll :scroll-bars
			     :both :vsp 3)))
  (:layout ((ISMA-COMMAND
	       (:column 1 (isma-menu :compute)
			  (isma-interaction :rest)  )))))

(defun Make-ISMA-Application-Frame ()
	 (clim:make-application-frame 'isma :pretty-name "ISMA" :parent
			*ISMA-ROOT* :left 5 :top 5 :height 150 :width
			400)) )

(defun Make-ISMA-Application-Frame ()
  (declare (special *ISMA-ROOT*))

	  (clim:make-application-frame 'isma :pretty-name "ISMA"
	  :parent *ISMA-ROOT* :left 5 :top 5 :height 150 :width 400)) )

(defun ISMA ()
  (declare (special *ISMA-ROOT* *MENU-ASSOCIATED-WINDOW*

  (unless *ISMA-ROOT*
    #+(and CLOE MS-Dos) (setq *ISMA-ROOT* (clim:open-root-window
    #+(and CLOE (not MS-Dos)) (setq *ISMA-ROOT* (clim:open-root-window
    #+Genera (setq *ISMA-ROOT* (clim:open-root-window :sheet))
    #+Unix (setq *ISMA-ROOT* (clim:open-root-window :clx :host
    (setq *MENU-ASSOCIATED-WINDOW* (PLOT:Make-Clim-Window)) )
    (setq *ORIGINAL-TEXT-STYLE* clim:*default-text-style*)
    (setq clim:*default-text-style* (clim:make-text-style :fix :roman
    :small)) )


  #+CLOE (setq clim:*default-text-style* *ORIGINAL-TEXT-STYLE*)

  (Kill-All-Windows) )

(defun ISMA-Present (object presentation stream x &optional newline)
  (format stream "~:[~VT~;~%~VT~]" newline x)
  (clim:present object presentation :stream stream))

(clos:defclass Edges-Set-Dynamic-Window (#+Genera
					 #+Unix clim::clx-window
					 #+(and CLOE MS-Dos)
					 #+(and CLOE (not MS-Dos))
  ((displayed-obj :initarg :displayed-obj :initform NIL :accessor
  displayed-obj)   ))

(defun Open-Edges-Set-Dynamic-Window (&key left top width height object
  (let ((window
	  (clim:open-window-stream :parent *ISMA-ROOT*
				   ; :displayed-obj object
				   :left left
				   :top top
				   :width width
				   :height height
				   :initial-cursor-visibility :off
				   :scroll-bars :both
				   :label label
				   :vsp 1
				   :window-class (clos:find-class
    (setf (displayed-obj window) object)

; Window used to output results
(defun Setup-Contract-Window (contract-object)
  (cond ((> *WO-WINDOW-Y* *WO-WINDOW-Y-LIMIT*)
	(t (setq *WO-WINDOW-X* (+ 2 *WO-WINDOW-X*))
	   (setq *WO-WINDOW-Y* (+ 15 *WO-WINDOW-Y*))))
  (let ((window #+CLOE
		(Open-Edges-Set-Dynamic-Window :left *WO-WINDOW-X* :top
		*WO-WINDOW-Y* :width 600
					       :height 100 :object
		(Open-Edges-Set-Dynamic-Window :left *WO-WINDOW-X* :top
		*WO-WINDOW-Y* :width 700
					       :height 110 :object
    (setf (Contract-Window contract-object) window)
    (push window *ISMA-WINDOWS*)

(clim:define-command-table ISMA-hyper-links)

;;;   BJM [10/16/92] - Replaced ISMA-hyper-links with ISMA for
;;;   BJM [10/16/92] - Above didn't work either, changed back
(clim:define-command (ISMA-Display-Ship-Group :name "Display Ship
Group" :command-table ISMA-hyper-links)
    ((object T))
  (Display-Ship-Group-Summary object))

(clim:define-presentation-to-command-translator Display-ISMA-Ship-Group
    (Contract-Display-Ship-Group-Number ISMA-Display-Ship-Group
  :gesture  :select
  :echo NIL)
  (list object))

;;; Contract object display methods

(clim:define-presentation-method clim:present (contract (type
							stream view
  (declare (ignore view))
  (format stream "~a" (Ship-Group-ID contract)))

(clim:define-presentation-method clim:present (contract (type
Contract-Display-Ship-Group-Weight) stream view &key)
  (declare (ignore view))
  (format stream "~5D"  (Ship-Group-Weight contract)))



Main Index | Thread Index