Help understanding command tables

Greg Bennett gwbennett at sentex.ca
Thu Mar 7 01:45:32 UTC 2019


 From Greg Bennett running sbcl 1.4.11 (64bit) under linux mint 18.1 (64bit)
and using mcclim-2019-0202-git, as far as I can tell.

 From that git, I'm using the file Examples/menutest.lisp as a basis for 
experiments with menus,
menubars, adding and removing menus.

;; START File contents of Examples/menutest.lisp
;;;  (c) copyright 2000 by
;;;          Robert Strandh (robert.strandh at gmail.com)

;;; This library is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU Library General Public
;;; License as published by the Free Software Foundation; either
;;; version 2 of the License, or (at your option) any later version.
;;;
;;; This library is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;; Library General Public License for more details.
;;;
;;; You should have received a copy of the GNU Library General Public
;;; License along with this library; if not, write to the
;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;;; Boston, MA  02111-1307  USA.

(defpackage #:menutest
   (:use :clim :clim-extensions :clim-lisp)
   (:export #:menutest))

(in-package #:menutest)

(define-application-frame menutest ()
   ()
   (:menu-bar menubar-command-table)
   (:panes
    (screen :application
            :display-time nil
            :text-style (make-text-style :sans-serif :roman :normal)))
   (:layouts
    (defaults (vertically () screen))))

(define-menutest-command com-file ()
   (format *standard-output* "You pressed the File button.~%")
   (finish-output *standard-output*))

(define-menutest-command com-hello ()
   (format *standard-output* "You pressed the Hello button.~%")
   (finish-output *standard-output*))

(define-menutest-command com-hi ()
   (format *standard-output* "You pressed the Hi button.~%")
   (finish-output *standard-output*))

(make-command-table 'buffer-command-table
             :errorp nil
             :menu '(("Hello there" :command com-hello)
                 ("Hi there"    :command com-hi)))

(make-command-table 'menubar-command-table
             :errorp nil
             :menu '(("Buffer" :menu buffer-command-table)
                 ("File"   :command com-file)))
;; END file contents

Inside the package menutest, I added this form:

(defun run-menutest (thread-name)
   (flet ((run ()
               (let ((frame (make-application-frame 'menutest)))
                 (run-frame-top-level frame))))
         (sb-thread::make-thread #'run :name thread-name)))

so that I can create the frame and keep the listener.

All seems to function as expected, so I tried to find out a little about 
what I had created:

(find-command-table 'menubar-command-table) ; ->
#<STANDARD-COMMAND-TABLE MENUBAR-COMMAND-TABLE {10018D6A43}>
;; OK

(command-table-name (find-command-table 'menubar-command-table))
;; ->MENUBAR-COMMAND-TABLE ;; possibly good

;;; Before trying to modify things, check which commands are there
(map-over-command-table-commands #'command-name (find-command-table 
'menubar-command-table))
;;->

The value
   CLIM-INTERNALS::COM-NULL-COMMAND
is not of type
   LIST

I would appreciate pointers to what I have missed so far in exploring 
command-tables.

Cheers /Greg Bennett



More information about the mcclim-devel mailing list