CLIM mail archive


Command tables/menus (CLIM 1.0)

    Date: Mon, 11 May 1992 17:24 EDT
    From: Curt Eggemeyer <>

    This is a quickie how to question.  My situation is as follows:

    I want each of my command-tables to appear as a single item on my
    :command-menu pane.  When I click on one of them then a sub-menu of a
    subset of the commands within that command-table to appear for selection.
    I also want every command within all of my commands invokable from an
    interactor pane. I know I can use add-menu-item-to-command-table or include the sub-command spec in the define-command-table :menu form, but that
    means I have my menu specification separate from my command which seems
    messy.  Is there a way to get something like the example below to do what
    I want?  Is there something trivial I am missing?

    (define-command-table one)  ;it would be nice if there was a :menu t option
    (define-command-table two)

    (define-application-frame whatever () ()
	    (:panes (app :application) (active :interactor)
		    (top-most-menu :command-menu))
	    (layout ((normal
		      (column 1 (:row 1/50 (one 1/2) (two 1/2))
				(:row 1/10)
				(:row :rest app)))))
	    (:command-table (t :inherit-from (one two))))

    (define-command (test1 :command-table one :menu t :name t) () ...)
    (define-command (test2 :command-table one :menu t :name t) () ...)
    (define-command (test3 :command-table one :menu t :name t) () ...)
    ;;Here we have 3 different commands in command-table two but their menu
    ;;items appear similar to those in command-table one's!
    (define-command (test4 :command-table two :menu "test1" :name t) () ...)
    (define-command (test5 :command-table two :menu "test2" :name t) () ...)
    (define-command (test6 :command-table two :menu "test3" :name t) () ...)
     ... etc.

The CLIM test suites, the source of which is included with CLIM
distributions in SYS:CLIM;TESTS;TEST-SUITE.LISP, does exactly this.

(define-command-table graphics)

(define-command (... :command-table graphics) ...)
(define-command (... :command-table graphics) ...)

(define-command-table output-recording)

(define-command (... :command-table output-recording) ...)
(define-command (... :command-table output-recording) ...)


(define-application-frame clim-tests ()
  (:command-table (clim-tests
		   :inherit-from (graphics
		   :menu (("Graphics" :menu graphics)
			  ("Output Recording" :menu output-recording)
			  ("Formatted Output" :menu formatted-output)
			  ("Redisplay" :menu redisplay)
			  ("Presentations" :menu presentations)
			  ("Menus and Dialogs" :menu menus-and-dialogs)
			  ("Benchmarks" :menu benchmarks)
			  ("Exit" :command (exit-clim-tests)))))
  (:command-definer nil)
  (:panes ...)
  (:layout ...))


Main Index | Thread Index