1

Ltk is proving very frustrating due to missing and sometimes incorrect documentation. (You'll find that the button styling options don't work)

I'm trying to make a simple scrolled frame that contains NxN many buttons. Unfortunately, the scroll bars never seem to "get it". It would seem like a no brainer that when you shove too many things inside a container it provides a scrolling mechanism automatically. We've been doing this in TUIs and GUIs for a LONG time.

Can anyone fix the code given below? Bonus points if you can figure out how to colorize the buttons a mixture of colors.

<code>
(defun run-demo ()
  (with-ltk ()
    (wm-title *tk* "NxN Button Tray")
    (set-geometry *tk* 480 320 0 0)
    (let* ((sw (make-instance 'scrolled-frame :master *tk*)))
      (dotimes (y 20)
        (dotimes (x 20)
          (let* ((b (make-instance 'button
                                   :master (canvas sw)
                                   :text (format nil "(~a,~a)" x y))))
               (grid b x y))))
      (pack sw))))
</code>

Here is a screenshot of the problem. The scrollbars refuse to see their internal widget needs scrolling.

Scrollbars not expanding

Thank you greatly for taking a whack at it... Sincerely, Pixel_Outlaw

Mustafa
  • 977
  • 3
  • 12
  • 25

1 Answers1

2

I'm sure others will come across the same problem. The answer was to use the following (interior w) accessor. I only found this by browsing archives of the mailing list. Jury is still out on the color scheme though.

(defun run-demo ()
  (with-ltk ()
    (wm-title *tk* "NxN Button Tray")
    (set-geometry *tk* 480 320 0 0)
    (let* ((sw (make-instance 'scrolled-frame :master *tk*)))
      (dotimes (y 20)
        (dotimes (x 20)
          (let* ((b (make-instance 'button
                                   :master (interior sw) ;push inside here!
                                   :text (format nil "(~a,~a)" x y))))
               (grid b x y))))
      (pack sw))))