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@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
Hey Greg,
On Wed, 6 Mar 2019 20:45:32 -0500 Greg Bennett gwbennett@sentex.ca wrote:
(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.
From map-over-command-table-commands specification[1]:
"Applies function to all of the commands accessible in the command table specified by the command table designator command-table. function must be a function that takes a single argument, the command name; it has dynamic extent. "
So if you want command names you simply go with: (map-over-command-table-commands #'identity (find-command-table 'menubar-command-table))
nb: Commands are represented as a (list* command-name args)[2].
From another note, I'm planning to write a blog post about commands soon. It will focus on "interfaces" as opposed to "application frames" to put some emphasis on "why CLIM is different", and where "Interface Manager" comes from (as opposed to "Toolkit" - that would make it CLT).
Cheers /Greg Bennett
Best regards, Daniel
[1] http://bauhh.dyndns.org:8000/clim-spec/27-2.html#_1404 [2] http://bauhh.dyndns.org:8000/clim-spec/27-1.html#_1374