Class | Package: cg | ToC | DocOverview | CGDoc | RelNotes | Index | PermutedIndex
| Allegro CL version 8.1 This page is new in 8.1.

## lamp-column-moxin

A non-instantiable class that can be mixed with the `grid-column` class to create grid columns whose cells draw lamp widgets. Each cell in the column will display a lamp if the row of that cell is an instance of a `grid-row` subclass that mixes in the `widget-row-mixin` class.

To ensure that this mixin class' methods take precedence over other methods that specialize on grid-column, this mixin class generally should appear first in a defclass expression's list of superclasses, as in:

    (defclass my-lamp-column
      (lamp-column-mixin my-subclass-of-grid-column) ...)

The draw-cell method provided by this mixin will draw (in each cell) the single lamp widget that is the value of the lamp-widget property of the grid column. It will call read-cell-value to determine the state of the lamp (off, on, or blinking) in each cell. The grid column may be given a data-read-converter function to convert arbitrary application values into corresponding lamp state values (`nil`, `t`, and `:blinking`).

The grid column may be given a title-reader property to determine the string to display in each lamp cell. If there is no title-reader function or it returns `nil`, then no label will be displayed beside the lamp image (and the lamp image will be centered within the grid cell).

Here is a typical expression for creating a lamp grid column. It assumes that the data-object of each `grid-row` has a slot called danger-level containing one of the values `:low`, `:moderate`, or `:high`.

    (make-instance 'my-lamp-column
      :name :danger-level
      :proportional nil
      :section-size 24
      :data-reader 'danger-level
      :data-read-converter (lambda (user-value)
                             (case user-value
                               (:low nil)
                               (:moderate t)
                               (:high :blinking)))
      :lamp-widget (make-instance 'lamp
                     :on-color red
                     :lamp-shape :triangle
                     :lamp-width 16
                     :lamp-height 12))

The Employee grid example in the Navigator Dialog includes a lamp column.

See the section Built-In Grid Cell Widgets on the page for the `grid-widget` class for an overview of the grid column mixins.

A quicker but less object-oriented alternative to using the `widget-column-mixin` classes is to write cell-widget methods.

See the `lamp` widget.

Copyright (c) 1998-2007, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page is new in the 8.1 release.
Created 2005.9.20.

|  | ToC | DocOverview | CGDoc | RelNotes | Index | PermutedIndex
| Allegro CL version 8.1 This page is new in 8.1.