menu-items-for-combo-box-range

Generic Function

Package: common-graphics

Arguments: range-object-list row column

This generic function is called when a grid combo-box cell (a cell in a combo-box-column-mixin column) is about to show its choices to the user as a pop-up menu that is displayed somewhat like a combo-box. The method returns a list of menu-items to display. The menu-values are a list of the actual choices for the cell, as returned by the column's range-reader function called on the row's data-object.

The default method creates menu-items with the print-name of each choice displayed in the menu. An application could add a method to this generic function to instead create menu-items that have some sort of alternative string displayed on the menu for each choice.

Here's an example of defining a custom menu-items-for-combo-box-range method for an application's own combo-box grid-column subclass. The method adds a sequential number (1 through N) to each of the choices that are displayed to the user.

(defclass my-combo-box-column 
          (combo-box-column-mixin grid-column)())

(defmethod menu-items-for-combo-box-range
    (range-object-list row (column my-combo-box-column))
  (declare (ignore row))
  (let* ((number 0))
    (mapcar #'(lambda (object)
                (make-instance 'menu-item
                  :value object
                  :title (format nil "~a ~a" (incf number) object)))
      range-object-list)))

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.