[rdnzl-devel] Re: RDNZL
Edi Weitz
edi at agharta.de
Fri Dec 24 01:05:17 UTC 2004
Hi!
Please use the mailing list for bug reports and questions. Thanks.
On Thu, 23 Dec 2004 16:06:22 -0600, "Francisco Rivera" <jfrivera56 at hotmail.com> wrote:
> I have 2 problems:
>
> 1) with
>
> (defun message-box (text &optional (caption "Message"))
> [Equals [MessageBox.Show text caption [$MessageBoxButtons.OKCancel]]
> [$DialogResult.OK]])
>
> the following problems appears when I use Spanish characters:
>
> (message-box "botón")
>
> Error: External format FLI:ASCII-WCHAR got error writing #<Pointer to type
> FLI::WCHAR-T = #x008B0258> at position 2: Non-ASCII character #\ó.
That was an oversight of mine, sorry. I forgot to specify an external
format in port-lw.lisp. Please try the 0.4.4 release which should fix
this.
> 2) How I can create a push button event (Click)?
>
> The following is not working:
>
> (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")
> (use-namespace "System.Windows.Forms")
> (use-namespace "System.Drawing")
>
> (let ()
> (defun clicked ()
> (message-box "Boton presionado")))
>
> (defun make-control (tipo &optional (x 0) (y 0) (texto ""))
> (let ((ctl (new tipo))
> (pto (new "Point")))
> (setf (property pto "X") x
> (property pto "Y") y
> (property ctl "Location") pto
> (property ctl "Text") texto)
> ctl))
>
> (defun calculator ()
> (let ((forma (new "Form"))
> (tb1 (make-control "TextBox" 0 0))
> (tb2 (make-control "TextBox" 100 0))
> (etiq (make-control "Label" 0 75))
> (boton (make-control "Button" 0 25 "ADD")))
> (setf (property forma "Text") "Lisp.Net Calculator")
> (invoke (property forma "Controls") "Add" boton)
> (invoke (property forma "Controls") "Add" tb1)
> (invoke (property forma "Controls") "Add" tb2)
> (invoke (property forma "Controls") "Add" etiq)
> [+Click boton (new "EventHandler" #'clicked)]
> [Application.Run forma]
> forma))
>
>> (calculator)
>
> Error: Trying to call function RDNZL::%INVOKE-CONSTRUCTOR with NULL object
> #<RDNZL::CONTAINER NULL #xBC4810>.
At least two things need to be fixed in the code above:
1. You forgot to import the type "System.EventHandler" which you need.
That's actually the cause for the error message - you should have
checked the backtrace. Add these two lines:
(import-type "System.EventHandler")
(use-namespace "System")
2. CLICKED has the wrong signature. It'll get two arguments like any
event handler and you have to specify them:
(defun CLICKED (object event)
...
Of course, you can IGNORE them if you want.
I hope that'll bring you on the right track. Let me know if you still
have problems.
Cheers,
Edi.
More information about the rdnzl-devel
mailing list