[mcclim-devel] menu bars

Christophe Rhodes csr21 at cantab.net
Fri Jan 5 10:28:25 EST 2007


Hi,

Consider the attached code, which demonstrates that it is possible
with current McCLIM to change the contents of menus from within the
app.  So far, no surprises -- we have a nice dynamic UI, right?

The surprise is that it isn't possible to do this to the contents of
the menu bar itself: the menus there are fixed when the pane is
instantiated, I believe.  So my question: is this intentional?  Is it
desireable?  (And what does Legacy CLIM do? :-)

Cheers,

Christophe

-------------- next part --------------
(in-package :clim-user)

(define-application-frame menus ()
  ()
  (:menu-bar menubar-command-table)
  (:panes 
   (interactor :interactor)
   (application :application :display-time nil))
  (:layouts
   (default
     (vertically ()
       application
       interactor))))

(define-command-table commands-command-table) 

(define-command-table menubar-command-table
  :menu (("Commands" :menu commands-command-table)))

(define-menus-command (com-add-command :name t) ((name 'string))
  (add-menu-item-to-command-table 
   'commands-command-table name :command `(com-display ,name)
   :errorp nil))

(define-menus-command com-display ((name 'string))
  (format *standard-output* "~&Displaying ")
  (present name 'string)
  (terpri))

(define-menus-command (com-remove-command :name t) ((name 'string))
  (remove-menu-item-from-command-table 
   'commands-command-table name :errorp nil))

(define-presentation-to-command-translator string-to-remove-command
    (string com-remove-command menus)
    (object)
  (list object))


More information about the mcclim-devel mailing list