views:

117

answers:

1

The kind of functions are of the sort of:

(defun display-all () "Display all items in the database." (dolist (item database) (format t "~{~a:~10t~a~%~}~%" item)))

(defun prompt-read (prompt) (format query-io "~a: " prompt) (force-output query-io) (read-line query-io))

(defun prompt-for-item () (make-database (prompt-read "Name") (prompt-read "Price")))

I've read the Ltk documentation, but there doesn't seem to be any examples of text widget usage.

+2  A: 

You create the text widget like every other widget. The Lisp-side object has text accessor function with writer method which sets the text on Tk side. Minimal example:

(with-ltk ()
  (let* ((text-widget (make-instance 'text :width 15 :height 2))
         (b1 (make-instance 'button
                            :text "Print"
                            :command #'(lambda () (princ (text text-widget)))))
         (b2 (make-instance 'button :text "Reset"
                            :command #'(lambda () (setf (text text-widget) "reset")))))
    (pack text-widget)
    (pack b1)
    (pack b2)))
Ramarren