CLIM mail archive
[Prev][Next][Index][Thread]
Two menu-item panes each with its own command-table??
Date: Mon, 23 Dec 1991 13:12 EST
From: "William (Bill" <waarbau@tycho.ncsc.mil>, "Arbaugh)"@BBN.COM
PROBLEM: How to have more than one configuration each with
its own menu pane and command table.
The following works for me:
================================================================
;;; -*- Mode: LISP; Syntax: Common-Lisp; Base: 10; Package: CLIM-USER -*-
;;;>*********************************************************************
;;;>
;;;> Symbolics hereby grants permission to customer to incorporate
;;;> the examples in this file in any work belonging to customer.
;;;>
;;;>*********************************************************************
;;; Simple example of how to use command-table inheritance to get
;;; multiple menus in a frame.
(define-command-table primary)
(define-command (com-red :command-table primary :menu t) ()
(echo-command *application-frame* "Red"))
(define-command (com-blue :command-table primary :menu t) ()
(echo-command *application-frame* "Blue"))
(define-command (com-green :command-table primary :menu t) ()
(echo-command *application-frame* "Green"))
(define-command-table secondary)
(define-command (com-yellow :command-table secondary :menu t) ()
(echo-command *application-frame* "Yellow"))
(define-command (com-cyan :command-table secondary :menu t) ()
(echo-command *application-frame* "Cyan"))
(define-command (com-magenta :command-table secondary :menu t) ()
(echo-command *application-frame* "Magenta"))
(clim:define-application-frame multi-menu ()
()
(:command-table (t :inherit-from (primary secondary)))
(:panes ((display :application)
(own-menu :command-menu)
(primary-menu :command-menu
:display-function '(clim:display-command-menu :command-table primary))
(secondary-menu :command-menu
:display-function '(clim:display-command-menu :command-table secondary))))
(:layout ((primary
(:column 1
(display :rest)
(:row 1/6 (primary-menu :compute) (own-menu :rest))))
(secondary
(:column 1
(display :rest)
(:row 1/6 (secondary-menu :compute) (own-menu :rest)))))))
(define-multi-menu-command (com-exit-multi-menu :menu "Exit") ()
(frame-exit *application-frame*))
(defmethod echo-command ((frame multi-menu) string)
(let ((stream (get-frame-pane frame 'display)))
(format stream "~%The ~A command." string)))
(define-multi-menu-command (switch-configurations :menu "Switch") ()
(let ((new-config (case (frame-current-layout *application-frame*)
(primary 'secondary)
(secondary 'primary))))
(set-frame-layout *application-frame* new-config)))
0,,
Follow-Ups:
References:
Main Index |
Thread Index