Changes between Version 9 and Version 10 of EasyGuiCurrencyConverter


Ignore:
Timestamp:
Oct 19, 2007, 4:56:36 PM (14 years ago)
Author:
asf
Comment:

Make last edit box non-editable; robustness

Legend:

Unmodified
Added
Removed
Modified
  • EasyGuiCurrencyConverter

    v9 v10  
    1212     :position (point 125 513)
    1313     :title "Currency Converter"
    14      :resizable-p t #+not-yet nil
     14     :resizable-p nil
    1515     :minimizable-p t))
    1616
     
    1818  (let ((currency-form (make-instance 'form-view
    1919                          :autosize-cells-p t
    20                           :interline-spacing 9.0
     20                          :interline-spacing 9d0
    2121                          :position (point 15 70)                         
    2222                          :size (point 353 90)))
     
    3030    (setf (action convert-button)
    3131          #'(lambda ()
    32               (let ((exchange-rate (entry-text currency-form 0))
    33                     (amount (entry-text currency-form 1)))
    34                 (unless (or (zerop (length exchange-rate))
    35                             (zerop (length amount)))
    36                   (setf (entry-text currency-form 2)
    37                         (prin1-to-string
    38                          (* (read-from-string exchange-rate)
    39                             (read-from-string amount))))))))
    40     (add-entries currency-form
    41                  "Exchange Rate per $1:" "Dollars to Convert:"
    42                  "Amount in other Currency:")
     32              (let ((n1 (read-from-string (entry-text currency-form 1)
     33                                          nil nil))
     34                    (n2 (read-from-string (entry-text currency-form 0)
     35                                          nil nil)))
     36                (when (and (numberp n1) (numberp n2))
     37                  (setf (entry-text currency-form 2)
     38                        (prin1-to-string (* n1 n2)))))))
     39    (setf (editable-p (car (last (add-entries currency-form
     40                                              "Exchange Rate per $1:"
     41                                              "Dollars to Convert:"
     42                                              "Amount in other Currency:"))))
     43          nil)
    4344    (add-subviews cw currency-form line convert-button)
    4445    (window-show cw)))
    4546
    46 ;(make-instance 'converter-window)
    47 }}}
     47;(make-instance 'converter-window)}}}