[ltk-user] ltk-tile make-instance 'button :command

Everett Fuller slac.in.the.box at gmail.com
Thu Apr 8 20:37:59 UTC 2010


Hello ltk-users

After looking at gtk, qt, and other widget tool kits, from my noob
perspective,  ltk-tile looked the most promising (even I might be able to do
it!) for creating guis with native look and feel.  Hats off to Mr. Herth in
extreme thanks for his work.

However, I am finding scanty documentation on ltk-tile, and have been mostly
relying on the ltk-tile.lisp file to try and figure out it's syntax. , In
the example function (tile-test), though creating a window with a label, an
entry, and a button, the button doesn't do anything.

I am hereby pasting in the code of two separate files.  The first one
successfully uses ltk to create a frame with a button in it that outputs
"Hello!" to the console when the button is clicked.

The second file tries to do the same thing, only using ltk-tile instead,
but  it is unsuccessful at outputing anything to the console.  Because I am
new to lisp, I still sometimes separate and indent the parentheses to help
me visually comprehend what is inside of what.

Here is code of first file:

*;; making a button in ltk that outputs "Hello" to the console when clicked

; load dependent systems
(load "/usr/local/lisp/systems/ltk/ltk")
(in-package :ltk)

; define function
(defun hellobutton ()
  (with-ltk ()
    (let* (
       (f (make-instance 'frame))
       (b (make-instance 'button
                 :master f
                 :text "hellobutton"
                 :command (lambda ()
                    (format t "~%~THello!~%"))))
       )
      (pack f)
      (pack b)
      (mainloop)
      )))

; use function
(hellobutton)
*


The above worked!!! But when I try it with ltk-tile it doesn't work.  Here
is the ltk-tile code that is trying to do same thing:

*;; trying to make a button with ltk-tile that outputs "Hello" to the
console when clicked

; load dependent systems
(load "/usr/local/lisp/systems/ltk/ltk")
(load "/usr/local/lisp/systems/ltk/ltk-tile")
(in-package :ltk-tile)

; define function
(defun hellobutton ()
(activate-tile)
  (with-ltk ()
    (let* (
       (f (make-instance 'frame))
       (b (make-instance 'button
                 :master f
                 :text "hellobutton"
                 :command (lambda ()
                    (format t "~%~THello!~%"))))
       )
      (pack f)
      (pack b)
      (dolist (theme (theme-names))
    (make-menubutton mtheme theme (lambda()
                    (use-theme theme))))
      (mainloop)
      )))

; use function
(hellobutton)
*


Unfortunately I am new to lisp, tcl, tk, and gui programming in general.
Any links to additional examples or tutorials on ltk-tile would be
appreciated.  I am happy to buy books too, so long as they cover ltk-tile.

Thanks in advance,

--Slac-in-the-box

(p.s.  I've started my 12-year-old on lisp, and he has already made a text
game in the fashioned after bsd-games "adventure" and he squeals with
excitement (same joyous sounds he makes on the way to visit other kids)
whenever he gets something to work!  He is only a day or two behind on
learning ltk and is asking questions for which I haven't any answers.  Thus,
the pressure is on for me to find answers!)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ltk-user/attachments/20100408/1f7f3bb1/attachment.html>


More information about the ltk-user mailing list