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

Re: Scrolling question

On 14 Feb 1994, Rob Browning asks creating a scrolling array.
The table contains 3 cvolumns and n rows:
>   I wanted to use a
>   separate sequence-dialog-item for each column.  This would allow me the
>   greatest number of rows (b/c of the 8K list manager limit).

>   Given this set up, what would be the best way to have one scroll bar that
>   scrolls all three items?  I thought about letting one of the
>   sequence-dialog-items have a scroll bar and update the other two columns
>   when the main one is scrolled.

Rob then mentions that he receives an error when he
tries to link three scroll columns.

Actually the problem occurs when there is one column:The other option I 
considered is having a separate scrollbar item that

(defun test-table ()
    ((a-list '(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16))
     (win (make-instance 'window))
      (make-instance 'sequence-dialog-item
        :table-sequence a-list
        :visible-dimensions #@(1 6)
        :view-container win
        :table-vscrollp '()))
      (make-instance 'scroll-bar-dialog-item
        :direction :vertical
        :view-container win
        :scrollee `(,t1))))))

? (test-table)
> Error: No applicable method for args:
>         ((#<SEQUENCE-DIALOG-ITEM #x311991>) CCL::SCROLL-BARS)
> Type Command-. to abort.
See the RestartsI menu item for further choices.

The array dialog item (array-dialog-item.lisp in the example folder)
handles 2-d arrays the way you want.  I'm not sure about
the upper limit but it does handle 2400 elements.

Here's an example.

First load  from the examples folder the file array-dialog-item.lisp
or compile the file and then load the fasl file. Now execute the
following. Scrolling by a page is slow! 

(in-package :ccl)
(defun make-test-array (&rest dimensions)
  (let* ((a (make-array dimensions))
         (dims (make-list (length dimensions) :initial-element 0)))
      (setf (apply #'aref a dims) (copy-list dims))
      (do ((ds dims (cdr ds))
           (lims dimensions (cdr lims)))
          ((null ds) (return-from make-test-array a))
        (if (>= (incf (car ds)) (car lims))
          (setf (car ds) 0)

(defun array-dialog-item-example (&rest dimensions)
  (let* ((a (apply #'make-test-array dimensions))
         (w (make-instance 'window :view-size #@(400 300))))
    (make-instance 'array-dialog-item
      :table-array a
      :table-hscrollp nil
      :table-vscrollp t
      :view-container w)))

(time (array-dialog-item-example 3 800))

Initializing the 2400 element array takes a very long time on a IIcx running
in 5147k:
(ARRAY-DIALOG-ITEM-EXAMPLE 3 800) took 14076 milliseconds (14.076 seconds) to 
Of that, 100 milliseconds (0.100 seconds) were spent in The
 Cooperative Multitasking Experience.
 88400 bytes of memory allocated.