[ltk-user] Example of scrollbar available?
Jason Miller
jason at milr.com
Fri Dec 13 00:30:47 UTC 2013
On December 12, 2013 3:13:27 PM PST, Josef Wolf wrote:
> On Do, Dez 12, 2013 at 12:27:59 -0800, Jason Miller wrote:
>> ;First make a textbox and a scrollbar to go with it:
>> (let ((tb (make-instance 'text :width 78 :height 20))
>> (tbsb (make-instance 'scrollbar :orientation :vertical)))
>> ;Now put them where you want them; I'm using pack as it's the least
code:
>> (pack tb :side :left)
> ...
>
> Thanks for the hint, Jason! But I am still struggling.
>
> Your example works fine. But it covers only a single text
> widget. I am trying
> to scroll a collection of widgets...
Well, strangely enough, tk doesn't have this as a widget. There are
variouls hacks to get it, and it looks like scrolled-frame implements it.
However, when setting the master of widgets that go in it, you'll need to
use the INTERIOR accessor like so:
(ltk:with-ltk ()
(let ((sf (make-instance 'ltk:scrolled-frame)))
(ltk:pack sf)
(loop for i from 1 to 20
for label = (make-instance 'ltk:label :master (ltk:interior sf) :text
"Hello, World!")
do (ltk:pack label))))
HTH,
Jason
More information about the ltk-user
mailing list