CLIM mail archive

[Prev][Next][Index][Thread]

deactivating sub-menu items



    Date: Thu, 28 Oct 1993 12:45 EDT
    From: Bruce Seely <bss@jupiter.risc.rockwell.com>

    In CLIM 2.0.beta2.0 on Allegro 4.2.beta2.0 [SPARC; R1] (7/6/93 14:26), ...

Hey! Somebody give Bruce a kewpie doll for being the first person to
notice this CLIM design hole.  (I'm amazed it's taken so long.)

When I realized this hole was there, I came up with a kludge.  On the
assumption that command names and command *table* names are disjoint,
we could always allow (SETF (COMMAND-ENABLED <comtab-name>) NIL), and
simply fix the one or two places in CLIM that call COMMAND-ENABLED to
also check for the case of a command table being enabled/disabled.

Is this kludge just too awful?  Should we come up with something real
for this, or do people think it's OK to overload COMMAND-ENABLED to
support enabling/disabling of command tables as well as commands?

    I see how to deactivate a command in a pull-down menu using COMMAND-ENABLED.
    What I need to do is dynamically deactivate a sub-menu in the same manner.  In
    the example below, I'd like to be able to specify whether the "Selected
    Filecards" menu item in the second command-table is active depending on the
    result of evaluating the form (selections frame), as would be done in the
    fictitious method COMMAND-TABLE-ENABLED.

    (define-command-table FOCUS-FRAME-REPORTS-MENU
	:menu (("Checks" :command  (COMMAND-STUB))
	       ("Filecards" :menu focus-frame-filecard-report-menu)))

    (define-command-table FOCUS-FRAME-FILECARD-REPORT-MENU
	:menu (("All Filecards" :command (com-focus-frame-print-all-filecards))
	       ("Leaf Filecards" :command (com-focus-frame-print-leaf-filecards))
	       ("Selected Filecards" :menu focus-frame-selected-filecard-report-menu)))

    (define-command-table FOCUS-FRAME-SELECTED-FILECARD-REPORT-MENU
	:menu (("Assemblies Only" :command (com-focus-frame-print-selected-filecards))
	       ("Include Components" :command (com-focus-frame-print-subset-filecards)))) 


    (defmethod COMMAND-TABLE-ENABLED ((commamnd-table-name
				       (eql 'focus-frame-selected-filecard-report-menu))
				      (frame focus-frame))
      (selections frame))


Follow-Ups: References:

Main Index | Thread Index