[comp.sys.next] How to do Windows in Allegro Common Lisp?

mcdonald@fornax.UUCP (Ken Mcdonald) (03/29/91)

Here I sit, with approximately thirty pounds of documentation in front of me, and
without a clue as how to do this...

I'm learning (well, trying) to use Allegro Common Lisp on the Next, to produce Next-style
applications.  The first step is to be able to
	1)  Create a window.
	2)  Show it on the screen.
	3)  Move it around from within the code.
	4)  Get rid of it.
As you might have guessed, I'm currently on step 0)  Contact the UseNet for help.

So, to begin;  I've loaded in all the necessary packages (objc, appkit, all that good 
stuff.)  Then, I type this.
	(setq w (send Window "new))
whereupon I am informed that the "new" method does not exist for windows.  (By the way,
stick another " in after that <new> in the code--yes, I did it correctly when I was
typing in Lisp.)  Look things up in the objective-C documentation, and sure enought,
there is no "new" method for windows.  (And why not, I'd like to know?)

Well, init looks like it might do the trick.  So, type
	(setq w (send Window "init"))
and I get back a message indicating that an objective-C object has been returned, hooray!
However, I don't know what kind of object because I don't understand the descriptions
ACL gives of returned objects (and don't know where to find and explanation in the docs,
if an explanation exists at all), and I'm suspicious by nature.  So, to verify that w
holds a window object, I type
	(send w "buttonMask")
which any true window should respond to.  Uh-oh, bad news, as ACL informs me that the
"buttonMask" message isn't implemented for that object.  "style", another window message,
also isn't recognized.  Whatever w is, it certainly isn't a window.

So I try to find out what w is.  There are a couple of ways to do this in ACL (the "isa"
function is one), and I try the ones I know about.  Sadly, slightly different types
are returned, and I can't understand what they mean anyways.  (What the heck is a "metaclass"
and how does it differ from a superclass anyway?)  My head aswim with strange concepts,
I finally turn to the fine people in the UseNet for help.

So can you help this poor, struggling, aspiring NeXT programmer?  What I want to do
seems so simple, and yet I haven't a clue as to how to go about it, or what I am doing
wrong.  Please note--I want to create the window entirely from within the Lisp code,
and not by setting it up in Interface Builder and then just sending messages to it.
Any comments, ideas, hints, advice, or solutions gratefully accepted.  Post here or
e-mail to

Ken McDonald
mcdonald@cs.sfu.ca
.

cox@Franz.COM (Charles A. Cox) (04/03/91)

In article <2381@fornax.UUCP> mcdonald@fornax.UUCP (Ken Mcdonald) writes:

> I'm learning (well, trying) to use Allegro Common Lisp on the Next, to produce Next-style
> applications.  The first step is to be able to
> 	1)  Create a window.
> 	2)  Show it on the screen.
> 	3)  Move it around from within the code.
> 	4)  Get rid of it.
> As you might have guessed, I'm currently on step 0)  Contact the UseNet for help.

  This answer may not seem very helpful to you, but you are
unfortunately going to have to read up on the NeXT documentation
regarding applications/toolkits in order to make effective use of them
in Allegro CL.  The Allegro CL Objective-C interface allows you to
link into the NeXT application building environment (NeXTStep), but
the LISP is not a NeXT application itself.  Creating windows generally
requires that an Application object already be created.

  Although you don't need to use Objective-C for the actual windowized
application programming, you still need to know how to read the
Objective-C in the NeXT documentation of the NeXT libraries to learn
the interfaces.  Once you understand how the interface to a NeXT class
is done using Objective-C, it is a simple matter to convert the
Objective-C code structure into LISP.  The advantage to doing this,
then, is that nature of LISP allows you to redefine and add new
methods and classes dynamically.

  You may wish to look at and try running the simple examples included
with the Allegro CL distribution.  These were done using the Interface
Builder (from NeXT 1.0) to create the interfaces (windows).  The lisp
programs themselves then make use of these windows as part of their
interfaces.

	Charley

--
---
Charles A. Cox, Franz Inc.        1995 University Avenue, Suite 275
Internet: cox@franz.com           Berkeley, CA  94704
uucp:     uunet!franz!cox         Phone: (415) 548-3600; FAX: (415) 548-8253