Hello

 

In LW Personal 4.3.7 I obtain the below errors when in the Editor, on “Calculator function”  I select  Definitions --> Compile

Previously all code was compiled with Buffer à Compile

 

The problem disappears when evaluate (enable-rdnzl-syntax) on Listener. Why?

 

Debugger pane:

--------------

 

Error: Illegal setf place "Calculador".

  1 (continue) Skip compiling form.

  2 Skip compiling #<EDITOR::EDITOR-REGION-STREAM #<EDITOR:BUFFER Ejercicio01.lisp> 2157B4DC>.

  3 (abort) Abort job 16 :(BIND-STANDARD-STREAMS-AND-EXECUTE #<EDITOR::EDITOR-OUTPUT-STREAM #<EDITOR:BUFFER Background Output> 216868C4> (INTERNAL-DO-WITH-RANDOM-TYPEOUT #<closure (SUBFUNCTION CAPI::WITH-RANDOM-TYPEOUT-FUNC CAPI::FUNCALL-BACKGROUND-JOB-WITH-TYPEOUT-AUX) 2068E242> #<EDITOR::EDITOR-OUTPUT-STREAM #<EDITOR:BUFFER Background Output> 216868C4> #<CAPI:EDITOR-PANE CAPI:EDITOR-PANE  2169D734> #<CAPI:COLLECTOR-PANE LISPWORKS-TOOLS::BACKGROUND-OUTPUT-PANE  21685D9C> T))

 

Type :b for backtrace, :c <option number> to proceed,  or :? for other options

 

 

Output pane:

------------

 

;;; Safety = 3, Speed = 1, Space = 1, Float = 1, Interruptible = 0

;;; Compilation speed = 1, Debug = 2, Fixnum safety = 3

;;; Source level debugging is on

;;; Source file recording is  on

;;; Cross referencing is on

; (TOP-LEVEL-FORM 1)

;;;*** Warning in CALCULADOR: [%TEXT assumed special

;;;*** Warning in CALCULADOR: FORMA] assumed special

 

Code:

------

 

(use-package :rdnzl)

 

(enable-rdnzl-syntax)

 

(import-types "System.Windows.Forms"

              "Application" "DockStyle" "Form"

              "KeyPressEventHandler"

              "MessageBox" "MessageBoxButtons" "DialogResult"

              "TextBox" "Button" "Label")

 

(import-types "System.Drawing" "Point")

 

(import-type "System.EventHandler")

 

(use-namespace "System.Windows.Forms")

(use-namespace "System.Drawing")

(use-namespace "System")

 

 

(defun message-box (text &optional (caption "Mensaje"))

  ;; check if the "OK" button was pressed

  [Equals [MessageBox.Show text caption  [$MessageBoxButtons.OKCancel]]

          [$DialogResult.OK]]) ;; we want the message box to have "OK" and "Cancel" buttons

 

(defun crea-control (tipo &optional (x 0) (y 0) (texto ""))

  (let ((ctl (new tipo))

        (pto (new "Point")))

    (setf [%X pto] x

          [%Y pto] y

          [%Text ctl] texto

          [%Name ctl] tipo

          [%Location ctl] pto)

    ctl))

 

(defun calculador ()

  (let ((forma (new "Form"))

        (tb1 (crea-control "TextBox" 0 0))

        (tb2 (crea-control "TextBox" 100 0))

        (etiq (crea-control "Label" 0 75))

        (boton (crea-control "Button" 0 25 "Sume")))

    (setf [%Text forma] "Calculador"

          [%MaximizeBox forma] nil)

    [Add [%Controls forma] tb1]

    [Add [%Controls forma] tb2]

    [Add [%Controls forma] boton]

    [Add [%Controls forma] etiq]

    ;[+Click boton (new "EventHandler" #'clicked)]

    [+Click boton

         (new "EventHandler"

              #'(lambda (&rest args)

                  (declare (ignore args))

                  (setf [%Text etiq]

                        (format nil "~S" (+ (pn:parse-number [%Text tb1])

                                            (pn:parse-number [%Text tb2]))))))]

         forma))

 

(defun display ()

  [Application.Run (calculador)])

 

(defun run ()

  (mp:process-run-function "Calculador" #+:lispworks nil #'display))

 

 

Regards

 

Francisco Rivera

jfrivera56@hotmail.com