CLIM mail archive
[Prev][Next][Index][Thread]
Thanks...and More Questions About Command Tables
Thanks to all who replied to my questions about hiding commands. I have
code working now to switch between a hierarchy of command tables. Now I have
a follow-up question concerning the inheritance.
I have the following hierarchy of command tables:
"e3-index" (root): contains commands "e3-quit" and "e3-select"
"e3-article" (inherits from e3-index): contains "e3-select-part", "e3-render",
"e3-home"
"e3-leaf" (inherits from e3-article): contains "e3-kill"
I use clim:define-command to place a command in one of these command tables.
When I switch to table "e3-article", I expect the menu to contain the
inherited command "e3-quit". This does not happen.
Is there a way for inherited (menu) commands to be included on the menus of
descendent command tables? Do I need to use the :MENU keyword of
CLIM:DEFINE-COMMAND-TABLE? (I'm also using the :AFTER :SORT keywords
in CLIM:DEFINE-COMMAND...)
Thanks,
Joe Sherman
joebob@cs.washington.edu
Here's the relevant code if you're interested:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Define E3 command table hierarchy:
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-command-table e3-index :inherit-from (clim:user-command-table))
(define-command-table e3-article :inherit-from (e3-index))
(define-command-table e3-render :inherit-from (e3-article))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Define E3 application commands:
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-command (e3-select :command-table e3-index)
((article 'e3-article))
(with-slots (selected-article selected-part) *application-frame*
(setf selected-article article)
(setf selected-part selected-article)
(setf (frame-command-table *application-frame*)
(find-command-table 'e3-article))
(set-frame-layout *application-frame* 'e3-article-layout)))
(define-command (e3-quit :menu ("Quit" . (:after :sort))
:command-table e3-index)
()
(frame-exit *application-frame*))
(define-command (e3-index :menu ("Index" . (:after :sort))
:command-table e3-article)
()
(setf (frame-command-table *application-frame*)
(find-command-table 'e3-index))
(set-frame-layout *application-frame* 'e3-index-layout))
(define-command (e3-render :menu ("Render" . (:after :sort))
:command-table e3-article)
()
(with-slots (selected-article) *application-frame*
(setf (frame-command-table *application-frame*)
(find-command-table 'e3-render))
(perform (display-via-shell selected-article))))
(define-command (e3-select-part :command-table e3-article)
((part 'e3-part))
(with-slots (selected-part) *application-frame*
(setq selected-part part)))
(define-command (e3-kill :menu ("Kill" . (:after :sort))
:command-table e3-render)
()
(with-slots (selected-article) *application-frame*
(setf (frame-command-table *application-frame*)
(find-command-table 'e3-article))
(perform (kill-renoir selected-article))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Translate presentations to commands:
;;;
;;; Clicking on an icon presentation returns its associated object
;;; (a LOOM instance).
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-presentation-to-command-translator e3-select-icon
(e3-article e3-select e3-index)
(object)
`(,object))
(define-presentation-to-command-translator e3-select-schema
(e3-part e3-select-part e3-article)
(object)
`(,object))
0,,
Follow-Ups:
Main Index |
Thread Index