[ltk-user] Example of scrollbar available?

Josef Wolf jw at raven.inka.de
Thu Dec 12 17:39:15 UTC 2013


On Do, Dez 12, 2013 at 12:59:32 +0100, Josef Wolf wrote:
> are there any examples of scrollbar usage available? I have a hard time to
> grasp how to use them, and I can't find any examples in the documentation.

With this code:

  (defun test-scrolled-frame ()
    (with-ltk (:debug 3)
      (let* ((root (make-instance 'frame))
             (scrolled (make-instance 'scrolled-frame :master root))
             (quit-button (make-instance
                           'button
                           :master root
                           :text "Quit"
                           :command (lambda ()
                                      (setf *exit-mainloop* t)))))

        (pack root :side :top)
        (pack scrolled :side :top)
        (pack quit-button :side :top)
 
        (dolist (number '(1 2 3 4 5 6 7 8 9))
          (let ((btn (make-instance 'button
                                    :master scrolled
                                    :text number
                                    :command (lambda ()
                                               (format t "~a~%" number)))))
            (pack btn :side :top :anchor :w))))

      (do-msg "huhu")))

I get an empty root window and the wish process hangs eating CPU.

If I change the code to use FRAME instead of SCROLLED-FRAME, the code works
fine (but obviously without a scrollbar)

Any suggestions?

-- 
Josef Wolf
jw at raven.inka.de



More information about the ltk-user mailing list