[ltk-user] ltk examples

Felip Alàez Nadal uu.nix.uu at gmail.com
Thu Nov 23 19:08:15 UTC 2006


Hello again:
You can convert between string and other types reading from memory:

(defun string2data ( str )
 "Converts a string to the data type that the lisp reader could read on It."
  (with-input-from-string ( stream str )
     (read stream )))

Maybe I've forgotten some parenthesis, I can't run my sbcl now, but that
works for me.


2006/11/23, Bernhard Graf <bgraf at adartis.de>:
>
> I made it !!! :-)
>
> (defun scaler ()
>    (with-ltk ()
>      (let* ((frm (make-instance 'frame))
>            (lab (make-instance 'label :master frm :text "Enter Name: "))
>            (ent (make-instance 'entry :master frm))
>            (age 0)
>            (textarea (make-instance 'frame))
>            (txt (make-instance 'scrolled-text :master textarea))
>            (scl (make-instance 'scale :label "Age:" :digits 1 :from 10 :to
> 50 :tickinterval 10))
>            (but (make-instance 'button :master textarea :text "Push Me"
>                                 :command (lambda () (append-text txt
> (concatenate 'string "Hello, "  (text ent ) (format nil ", you are ~D
> years old" (value scl))
>                                                                 )))))
>            )
>            (pack lab :side :left)
>            (pack ent :side :left)
>            (pack frm)
>            (pack scl)
>            (pack but)
>            (pack txt)
>            (pack textarea)
> )))
>
> Actually, while programming this seemingly simple example, I
> recognized that LISP has 1001 arithmetic functions, but when it comes
> to string-to-number-and-back conversion, it looks pretty bad.
>
> Is that so or am I just only looking at the wrong places ?
> I found a parse-number library from Matthew Danish and use format to
> convert from numbers back to strings, but the latter seems rather
> ugly compared to actual "functions" that I know from Turbo Pascal and
> the former is quite good, but still not completely universal.
>
> Greetings,
> Bernhard
>
> Am 23.11.2006 um 13:04 schrieb Peter Herth:
>
> > Or just (value myscale) if myscale is the scale widget....
> >
> > Peter
> > _______________________________________________
> > ltk-user site list
> > ltk-user at common-lisp.net
> > http://common-lisp.net/mailman/listinfo/ltk-user
>
>
> _______________________________________________
> ltk-user site list
> ltk-user at common-lisp.net
> http://common-lisp.net/mailman/listinfo/ltk-user
>



-- 
Felip Alàez Nadal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ltk-user/attachments/20061123/159ec9ba/attachment.html>


More information about the ltk-user mailing list