scrollbar for aggrelist
Wolfgang Mederle <[email protected]> 26 Mar 2003 12:29:49 +0100
| Newsgroups | gmane.lisp.garnet.user |
|---|---|
| Organization | Die Bande, in die alle wollen |
| Message-ID | <[email protected]> |
Is there a way to add a v-scrollbar to an aggrelist? I have an aggrelist
of varying length modelled after the framed-text-list example in the
Aggre* Tutorial (1.5.2.6 An Aggrelist with an Interactor). As I don't
know how many items it will have, I'd like to make use of a v-scroll
when the list gets longer than a certain number. If this is possible,
how, or is there a better way to do this?
Here's the code for the function, and, yes, it's part of the umpteenth
incarnation of an mp3 encoder/id3 tagger frontend, the only difference
of this being that it's written in Common Lisp and aimed at helping me
encode music ripped from vinyl.
(defun get-names-gui ()
"Display artist, track names, year, and genre, and let the user interactively
change them."
(let* ((names-win (create-instance NIL inter:interactor-window
(:left 150) (:top 80) (:width 800) (:height 600)))
(agg (create-instance NIL opal:aggregate))
(header-box (create-instance NIL opal:rectangle
(:top 2) (:left 2)
(:width (o-formula (- (g-value names-win :width) 4)))
(:height 40)
(:filling-style opal:orange-fill)))
(header (create-instance NIL opal:text
(:left (o-formula (opal:gv-center-x-is-center-of names-win)))
(:top 10)
(:font (opal:get-standard-font :fixed :bold :large))
(:string "Album data")))
(artist (create-instance NIL gg:scrolling-labeled-box
(:label-string "Artist: ")
(:label-font (create-instance NIL opal:font (:face :bold)))
(:top 55) (:left 20) (:width 470)
(:value (names-artist *alb*))
(:selection-function
#'(lambda (inter obj)
(setf (names-artist *alb*) obj)
(setf (names-artist-clean *alb*) (rem-trouble-char obj))
inter))))
(titles-title
(create-instance NIL opal:text
(:left (o-formula (opal:gv-center-x-is-center-of names-win)))
(:top 85)
(:font (opal:get-standard-font :sans-serif :bold :large))
(:string "List of Tracks:")))
(titles
(create-instance NIL opal:aggrelist
(:left 0)
(:top (o-formula (+ (gv titles-title :top) 25)))
(:height 100)
(:items (names-title-list *alb*))
(:item-prototype
`(,opal:aggregadget
(:parts
((:frame ,opal:rectangle
(:left ,(o-formula
(opal:gv-center-x-is-center-of names-win)))
(:top ,(o-formula (gvl :parent :top)))
(:width 380)
(:height ,(o-formula (+ (gvl :parent :text :height) 4))))
(:text ,opal:text
(:left ,(o-formula
(opal:gv-center-x-is-center-of names-win)))
(:top ,(o-formula (+ (gvl :parent :top) 2)))
(:cursor-index nil)
(:string ,(o-formula
(nth (gvl :parent :rank)
(gvl :parent :parent :items)))))))
(:interactors
((:text-inter ,inter:text-interactor
(:window ,(o-formula
(gv-local :self :operates-on :window)))
(:feedback-obj nil)
(:start-where ,(o-formula
(list :in (gvl :operates-on :text))))
(:stop-event (:leftdown #\Return))
(:final-function
,#'(lambda (inter text event string x y)
(let ((elem (gv inter :operates-on)))
(opal:change-item (gv elem :parent)
string
(gv elem :rank))
text event x y))))))))))
(done-button (create-instance NIL gg:text-button
(:left (o-formula
(opal:gv-center-x-is-center-of names-win)))
(:top 350)
(:string "done")))
(done-button-inter (create-instance NIL inter:button-interactor
(:window names-win)
(:start-where (list :in done-button))
(:continuous t)
(:final-function
#'(lambda (done-button-inter obj)
(setf (names-title-list *alb*)
(gv titles :items))
(setf (names-title-list-clean *alb*)
(mapcar #'rem-trouble-char
(names-title-list *alb*)))
(opal:destroy names-win)
done-button-inter obj)))))
(s-value names-win :aggregate agg)
(opal:add-components agg header-box header artist
titles-title titles done-button done-button-inter)
(opal:update names-win)))
--
Wolfgang Mederle
$BONMOT