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

Re: table-dialog-item

>Here is a pretty silly question -
>Is there a programable way to set the contents of a (single) cell of a
>table-dialog-item or a sequence-dialog-item?  I do not want to set the
>contents of the entire sequence (i.e., with set-table-sequence - I'd like
>something like "set-cell-content"), as I do not know what the content is.
>(I may be reading the content in from a file, and would like to create
>the table first and fill the content as I go along).
>Am I missing something obvious?

A table-dialog-item has no concept of "setting the contents of a cell".
The contents is returned by the CELL-CONTENTS generic function, which
is called by the default DRAW-CELL-CONTENTS method. If you specialize
CELL-CONTENTS, you can compute the value every time rather than storing
it in a data structure. If you specialize DRAW-CELL-CONTENTS, you can
prevent the consing done to convert the CELL-CONTENTS value into a

SEQUENCE-DIALOG-ITEM specializes CELL-CONTENTS to return an element
of a sequence. To change the value of a single cell, you change the
value of the corresponding element of the sequence and call REDRAW-CELL.
The function BM-DO-DIALOG-FILE-SEARCH in the file
"ccl:examples;boyer-moore.lisp" illustrates this. It also shows that when
the length of the sequence changes, you need to call SET-TABLE-SEQUENCE.

If you make your own class of TABLE-DIALOG-ITEM and specialize
CELL-CONTENTS or DRAW-CELL-CONTENTS, then when the value of a cell changes,
you can simply call REDRAW-CELL on that cell. If the size of your table
changes, you'll need to call SET-TABLE-DIMENSIONS, which will cause a redraw
of the entire table. If you want to prevent this redrawing, it should be
possible, but I haven't tried it yet. Ask me for more help if you really
want to do this, or look at:

   "MCL 2.0 CD:Additional MCL Source Code:lib:dialogs.lisp"