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

Re: Rutime setting scrolling-window field size?

On 1 Feb 94, Malcolm Pradhan writes:
  I am using the scrolling-window class to display data whose bounds
  changes as the user makes various choices. I understand that one can
  set the scrolling-window's 'field size', ie. the scroll bar's min and
  max, using the initarg :field-size, but it is not clear to me how to
  'legally' change it during runtime as the slot is read only.

The scrolling window code provides methods for doing this.
The code is in the examples folder in the file scrolling-windows.lisp.
Just remember to force the window to be redrawn after you
change the field values.

Suppose that win is a scrolling-window, then it is easy
to access the field size of thw scrolling region and horizontal
and vertical scrolling sizes. The methods set-scroll-bar-max
and set-scroll-bar min change the ranges of the scrolling regions.

(in-package ccl)
(with-slots (my-scroller) win
    (with-slots (field-size v-scroller h-scroller) my-scroller
        (set-scroll-bar-min v-scroller v-min)
        (set-scroll-bar-min h-scroller h-min)
        (set-scroll-bar-max v-scroller v-max)
        (set-scroll-bar-max h-scroller h-max)

For an example, see the file pic-window.lisp.hqx in the directory
/pub/MCL2/contrib/ available by anonymous ftp from cambridge.apple.com

The code allows you to display a picture in a scrolling window
and to set the degree of enlargement and reduction. 
The set-scale-pict method changes the scale, while preserving the
proportions of the picture.