[ltk-user] getting an item's ID

Kenny Tilton ktilton at nyc.rr.com
Wed Feb 1 19:01:48 UTC 2006


I am merging my Cells fork of LTk with LTk, by which I mean using as 
much as possible LTk low-level stuff along with my own DEF-C-WIDGET 
high-level stuff. Things look OK so far, but I had a problem using 
ltk::read-data to get back the item ID no after creating an item.

My problem is that the ID no comes back as an unvarnished "42". But 
read-data is looking for (:data <data>):

(defun read-data ()
  (let ((d (read-wish)))
    (if (listp d) ; paranoia check when we do not read a list eg. error 
messages from wish
    (progn
      (loop while (not (equal (first d) :data))
        do
        (setf *event-queue* (append *event-queue* (list d)))
        (setf d (read-wish)))
      (second d))
      (format t "read-data:~a~a~%" d (read-all *wish*)))))


How do I arrange for Tk to respond with (:data 42) when I create an 
item? Or does read-data need to handle un-tagged data from Tk differently?

Aside: I just noticed:

(defun read-event (&key (blocking t))
  (or (pop *event-queue*)
      (when (or blocking (can-read *wish*))
        (read-preserving-whitespace *wish* nil nil))))

Should that be checking to see if any data read from Tk is tagged 
(:callback ,,,,)?

kenny



More information about the ltk-user mailing list