Howdy Peter<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">I have to say, from the general style your code basically looks like<br>
the code I would write.<br></blockquote><br>Makes sense, since it's your code that I'm copying, hehe.<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
- what lisp are you using, SBCL has pi defined as a constant?  <br></blockquote><br>I have both clisp 2.48 and sbcl 1.0.35 installed, and just discovered that clisp also has pi predefined.  I started with clisp because it was already included with slackware, and the logic of a slacker is:  if Pat thought it was good enough, then it must be.  However, I have since learned that sbcl compiles to machine code whereas clisp compiles to byte code, and even in the ltk package, clisp can't do the "serve-event" stuff.  My goal is to write code that does read-time conditionalization for clisp and sbcl, and to use clisp when working on non-profit projects and sbcl when working on commercial projects.<br>
<br>Thanks for this invaluable resource.  I've been trying out the different widgets, and just tried the notebook instance, and am using it  in my current endeavor of making a gui to help with the maintenance of my dns server (i'm tired of manually creating and editing zone files by hand)... hopefully everything will work and I won't be back here begging for deliverance from my confusion.<br>
<br>Thanks again,<br><br>--Everett<br><br><div class="gmail_quote">On Tue, Apr 13, 2010 at 1:43 PM, Peter Herth <span dir="ltr"><<a href="mailto:herth@peter-herth.de">herth@peter-herth.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Everett,<br>
<br>
I have to say, from the general style your code basically looks like<br>
the code I would write.<br>
Just a few comments, none of them ltk related:<br>
<br>
- you set some variables, but never define them, rather use let*<br>
- what lisp are you using, SBCL has pi defined as a constant?<br>
- and the biggest one: DON'T use read on user input carelessly, try<br>
for example entering #.(do-msg "huch!") instead of a number and press<br>
calculate... read allows for evaluation of arbitrary lisp code.<br>
<br>
Of course, the dialog layout could be different, but thats just fiddling a bit<br>
with the options of pack...<br>
<br>
So the code could look like:<br>
<div class="im"><br>
(defun circularea ()<br>
  (with-ltk (:debug-tcl nil)<br>
    (wm-title *tk* "circularea")<br>
    (let* ((label-d (make-instance 'label<br>
                                   :text "A circle with a diameter of "))<br>
           (entry-d (make-instance 'entry<br>
                                   :text "0"))<br>
           (label-u (make-instance 'label<br>
                                   :text "units"))<br>
           (label-a (make-instance 'label<br>
                                   :text "has an area of "))<br>
           (label-r (make-instance 'label<br>
                                   :text "0"))<br>
           (label-su (make-instance 'label<br>
                                    :text "square units"))<br>
           (b (make-instance 'button<br>
                             :text "calculate"<br>
                             :command<br>
                             (lambda ()<br>
</div>                               (let* ((diameter (let ((*read-eval* nil))<br>
                                                  (read-from-string<br>
(text entry-d))))<br>
                                      (radius (/ diameter 2))<br>
                                      (area (* pi (* radius radius))))<br>
<div class="im">                                 (setf (text label-r) area))))))<br>
      (pack label-d)<br>
      (pack entry-d)<br>
      (pack label-u)<br>
      (pack label-a)<br>
      (pack label-r)<br>
      (pack label-su)<br>
      (pack b) )))<br>
<br>
<br>
</div><div><div></div><div class="h5">Peter<br>
<br>
_______________________________________________<br>
ltk-user site list<br>
<a href="mailto:ltk-user@common-lisp.net">ltk-user@common-lisp.net</a><br>
<a href="http://common-lisp.net/mailman/listinfo/ltk-user" target="_blank">http://common-lisp.net/mailman/listinfo/ltk-user</a><br>
</div></div></blockquote></div><br>