CLIM mail archive

[Prev][Next][Index][Thread]

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).

Thanks!!!!!!

--ben
E-mail: bjm@utrc.utc.com

;;;-----------------------------------------------------------------------------

;;; -*- 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        ;;;
;;;
;;;
;;;
Updates:
;;;
;;;  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 ()
   (setq *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*))

    (setq *ISMA-APPLICATION-FRAME*
	  (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*
  *ORIGINAL-TEXT-STYLE*))

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

  (clim:run-frame-top-level
   (Make-ISMA-Application-Frame))

  #+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
clim::sheet-window-stream
					 #+Unix clim::clx-window
					 #+(and CLOE MS-Dos)
					 clim::cloe-window-stream
					 #+(and CLOE (not MS-Dos))
					 clim::sheet-window-stream)
  ((displayed-obj :initarg :displayed-obj :initform NIL :accessor
  displayed-obj)   ))

;;;============
(defun Open-Edges-Set-Dynamic-Window (&key left top width height object
label)
  (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
				   'edges-set-dynamic-window))
	  ))
    (setf (displayed-obj window) object)
    window))

;;;============
; Window used to output results
(defun Setup-Contract-Window (contract-object)
  (cond ((> *WO-WINDOW-Y* *WO-WINDOW-Y-LIMIT*)
	 (setq *WO-WINDOW-X* *WO-INITIAL-WINDOW-X* *WO-WINDOW-Y*
	 *WO-INITIAL-WINDOW-Y*))
	(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
					       contract-object)
		#-CLOE
		(Open-Edges-Set-Dynamic-Window :left *WO-WINDOW-X* :top
		*WO-WINDOW-Y* :width 700
					       :height 110 :object
					       contract-object)))
    (setf (Contract-Window contract-object) window)
    (push window *ISMA-WINDOWS*)
    window))

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

;;;   BJM [10/16/92] - Replaced ISMA-hyper-links with ISMA for
:command-table
;;;   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
    ISMA-hyper-links
  :gesture  :select
  :echo NIL)
  (object)
  (list object))

;;; Contract object display methods

(clim:define-presentation-method clim:present (contract (type
Contract-Display-Ship-Group-Number)
							stream view
							&key)
  (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)))



0,,

Follow-Ups:

Main Index | Thread Index