From: vtail
Subject: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <9ff6b66.0409261040.5a85e040@posting.google.com>
Hello everyone,

- My question: 
I want to write and deploy a GUI Lisp application on Windows - what is
the best way to do that? Of course, measuring the "best way" may be
different - portability, steepness of the learning curve, speed,
usability etc.

- My background:
I've read a couple of online books re: Lisp programming, written a
couple of small Lisp programs, and is expecting my copy of Paul
Graham's "ANSI Common LISP" from Amazon.

I have a couple of years programming experience with Python, and
several years with C, C++, etc.

- Request clarification:
Can you please share your experience/advices, even the most general
ones - like "RTFM", "That was already discussed 1 billion times",
"Look at Garnet" (though it seems to be quite outdated :| ), etc.

- Closing
Thank you very much in advance,

Victor.

From: Jon Boone
Subject: Re: Lisp newbie: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <BD7C85D0.3720D%ipmonger@comcast.net>
On 2004-09-26 14:40, in article
···························@posting.google.com, "vtail" <·····@yandex.ru>
wrote:

> Hello everyone,
> 
> - My question: 
> I want to write and deploy a GUI Lisp application on Windows - what is
> the best way to do that? Of course, measuring the "best way" may be
> different - portability, steepness of the learning curve, speed,
> usability etc.

  What's your budget?

--jon
From: Rainer Joswig
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <joswig-2E55AF.23153826092004@news-50.dca.giganews.com>
In article <···························@posting.google.com>,
 ·····@yandex.ru (vtail) wrote:

> Hello everyone,
> 
> - My question: 
> I want to write and deploy a GUI Lisp application on Windows - what is
> the best way to do that? Of course, measuring the "best way" may be
> different - portability, steepness of the learning curve, speed,
> usability etc.
> 
> - My background:
> I've read a couple of online books re: Lisp programming, written a
> couple of small Lisp programs, and is expecting my copy of Paul
> Graham's "ANSI Common LISP" from Amazon.
> 
> I have a couple of years programming experience with Python, and
> several years with C, C++, etc.
> 
> - Request clarification:
> Can you please share your experience/advices, even the most general
> ones - like "RTFM", "That was already discussed 1 billion times",
> "Look at Garnet" (though it seems to be quite outdated :| ), etc.
> 
> - Closing
> Thank you very much in advance,
> 
> Victor.

LispWorks for Windows has a cross-platform GUI library (called CAPI)
and an Interface Designer.

http://www.lispworks.com
From: Tim Bradshaw
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <1096280289.561886.314800@k26g2000oda.googlegroups.com>
vtail wrote:
> Hello everyone,
>
> - My question:
> I want to write and deploy a GUI Lisp application on Windows - what
is
> the best way to do that? Of course, measuring the "best way" may be
> different - portability, steepness of the learning curve, speed,
> usability etc.
>

LispWorks is a delight to use for GUI apps on Windows in my
experience, and the applications will (or should: you may need to be a
bit careful here and there, but I never had any real issues) be
portable between Windows, Linux, several Unices, and MacOS.

I haven't written large GUI applications for it (well: I've written
large applications, with GUIS, but the GUIs were small), but I've
written a lot of small tools, such as data structure visualisation
tools, a newsgroup browser and other things. Writing something small
is really a delight - you can often get things to work completely in
the listener.  Larger systems I worked on typically ended up with a
whole bunch of tiny GUI development tools - such as, say, a browser
for heirarchically structured packages - which each got written in an
hour or so and then got used for several months, and I reckon that's
the sign of a good GUI system.

Of course, it isn't free.

--tim
From: Mark McConnell
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <d3aed052.0409270735.6c53ed8d@posting.google.com>
·····@yandex.ru (vtail) wrote in message news:<···························@posting.google.com>...
> Hello everyone,
> 
> - My question: 
> I want to write and deploy a GUI Lisp application on Windows - what is
> the best way to do that? Of course, measuring the "best way" may be
> different - portability, steepness of the learning curve, speed,
> usability etc.

There was a thread "how to do java in lisp ?" in this group starting
July 13, 2004.  Note especially the link to Bill Clementson's blog in
the third post.
From: Rand Sobriquet
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <1e249696.0409270802.5c468619@posting.google.com>
·····@yandex.ru (vtail) wrote in message news:<···························@posting.google.com>...
> Hello everyone,
> 
> - My question: 
> I want to write and deploy a GUI Lisp application on Windows - what is
> the best way to do that? Of course, measuring the "best way" may be
> different - portability, steepness of the learning curve, speed,
> usability etc.
> 

You have two choices:

1.  Evaluate the GUI toolkit that comes with Allegro Common Lisp - I
believe it is called Common Graphics.

2.  Evaluate the GUI toolkit that comes with Xanalys LispWorks - it is
called CAPI.

Both are complete GUI systems - you'll hardly ever find yourself
saying, "Oops!! It doesn't support coloured buttons!!!"




(please don't send me email - I'm running a spam experiment. sorry)
From: Frank Buss
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <cj9sv3$oqv$1@newsreader2.netcologne.de>
··········@eudoramail.com (Rand Sobriquet) wrote:

> 2.  Evaluate the GUI toolkit that comes with Xanalys LispWorks - it is
> called CAPI.
> 
> Both are complete GUI systems - you'll hardly ever find yourself
> saying, "Oops!! It doesn't support coloured buttons!!!"

I've tried to change the color of a button, but without success. First a 
window with a button:

  (capi:define-interface button-test ()  
    ()  
    (:panes   
     (my-button capi:push-button :text "Test"))  
    (:layouts   
     (row-of-buttons capi:row-layout '(my-button)))  
    (:default-initargs :title "Button Test"))

  (defparameter *b* (make-instance 'button-test))

  (capi:display *b*)

Now I can change the button text:

  (setf (capi:item-text (slot-value *b* 'my-button)) "Hello")

and I can change the color of the window, in which the button is:

  (setf (capi:simple-pane-background *b*) :red)

but I can't change the color of the button:

  (setf (capi:simple-pane-background (slot-value *b* 'my-button)) :red)

In Java Swing this is possible, but of course, not so nice with 
interactive entering and exploring the commands:

  import java.awt.*;
  import javax.swing.*;
  public class ButtonTest {
    public static void main(String[] args) {
      JFrame f = new JFrame("Button Test");
      JButton myButton = new JButton("Test");
      myButton.setBackground(Color.RED);
      f.getContentPane().add(myButton);
      f.pack();
      f.setVisible(true);
    }
  }

I think the reason for the bug in LispWorks is a limitation of the 
Windows API, because you need some kilobytes of code for a color button:

http://www.pablovandermeer.nl/ccolorbutton.html

But I don't care and simply want a library as easy useable as Swing, but 
more native than Tk. Even Java AWT can do it (substitute "JButton" with 
"Button" in the sample), which normally uses the low-level API, but the 
button is owner-drawn (you can download the source for nearly all Java-
libraries, JVM etc. from http://wwws.sun.com/software/communitysource/ ). 
Perhaps this is not the best solution, because with owner-drawn buttons 
you don't get the Windows XP Look-and-Feel with round edges. Any ideas 
how to change the color of a native-button with CAPI and LispWorks, 
without an image button?

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Rand Sobriquet
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <1e249696.0409272138.26db403f@posting.google.com>
Frank Buss <··@frank-buss.de> wrote in message news:<············@newsreader2.netcologne.de>...
> ··········@eudoramail.com (Rand Sobriquet) wrote:
> 
> > 2.  Evaluate the GUI toolkit that comes with Xanalys LispWorks - it is
> > called CAPI.
> > 
> > Both are complete GUI systems - you'll hardly ever find yourself
> > saying, "Oops!! It doesn't support coloured buttons!!!"
> 
> I've tried to change the color of a button, but without success.
                  [.......................]
> Any ideas 
> how to change the color of a native-button with CAPI and LispWorks, 
> without an image button?

Frank,

I was just making a weak joke.  (Sorry about that).  I have seen this
issue - let me see now - I think about 3 times on the LispWorks-HUG
mailing list, without a satisfactory reply.

Are you using the color on a command button to reflect some
application state?  For example, I once had this dialog box where I
allowed the user to change the background color of a working space. 
In the dialog box, I had a 10 by 10 pixel capi:output-pane thumbnail
with its background color as the current color of the working space. 
If you click in the capi:output-pane (picked up by the input model
trigger), the capi:prompt-for-color dialog box pops up and lets you
change the current background color.  The thumbnail capi:output-pane
also changes its background color to reflect the updated color.  So,
are you using the command button for something similar?

I think that using coloured command buttons are not a good idea in
todays guis.  Of course, I know that you must have some excellent
reasons, and that you must have thought it through carefully; but,
personally, I feel that it will look cheesy - you know, very Win16 or
Borland.

The best solution, as you have also noticed, may be to use bitmapped
buttons.

-R




(please don't email me - I'm running a spam experiment. thanks)
From: Frank Buss
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <cjc3ij$fgp$1@newsreader2.netcologne.de>
··········@eudoramail.com (Rand Sobriquet) wrote:

> Are you using the color on a command button to reflect some
> application state?  For example, I once had this dialog box where I
> allowed the user to change the background color of a working space. 

yes, I used the ColorBtn in a Window C++ GDI program I wrote some time ago 
for selecting a color . I don't know, if there is a style guide, what you 
have to do in such cases. In the display setting dialog on Windows XP it is 
a combo box, with a colored pane as the selected item, but in some other 
programs, like UltraEdit, it is a simple pane, with text, decribing that 
you have to click into the pane for choosing a color.

-- 
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
From: Rand Sobriquet
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <1e249696.0409282100.52209534@posting.google.com>
Frank Buss <··@frank-buss.de> wrote in message news:<············@newsreader2.netcologne.de>...
> ··········@eudoramail.com (Rand Sobriquet) wrote:
> 
> > Are you using the color on a command button to reflect some
> > application state?  For example, I once had this dialog box where I
> > allowed the user to change the background color of a working space. 
> 
> yes, I used the ColorBtn in a Window C++ GDI program I wrote some time ago 
> for selecting a color . I don't know, if there is a style guide, what you 
> have to do in such cases. In the display setting dialog on Windows XP it is 
> a combo box, with a colored pane as the selected item, but in some other 
> programs, like UltraEdit, it is a simple pane, with text, decribing that 
> you have to click into the pane for choosing a color.

I looked through the Microsoft style manual - it's called the
Microsoft Windows User Experience - a while ago to find a hint for
this exact issue, but it does not have any specific recommendation. I
ended up doing something similar to Adobe Acrobat: under Windows, you
go to the menu Edit > Preferences > General... > Full Screen.   I
tried to make it like the "Background Color:" line.  It did not change
its appearance when it was clicked, but it looked clickable because of
the border shadow. (This is Adobe Acrobat full version 5.0 - I don't
know about other versions).

Once the application was shipped, I noticed that no one was using the
color customizations.  So next upgrade, I replaced the color
combinations with a capi:text-input-choice defining three "skins":
grey, blue, and plain.  Still, I noticed that everyone was using the
default "grey" and so I said, "forget it" and I removed this
functionality.

Incidently, on Mac OS X 10.3, iCal (the calendar program) uses only a
simple pane for choosing colors, and I think it looks okay.  It
doesn't even have any accompanying text and, still, it looks like a
natural way to select colors.


-Rand



(sorry, but please don't send me email - I'm running a spam
experiment)
From: Andras Simon
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <vcdd60789he.fsf@csusza.math.bme.hu>
Frank Buss <··@frank-buss.de> writes:

> 
> In Java Swing this is possible, but of course, not so nice with 
> interactive entering and exploring the commands:
> 
>   import java.awt.*;
>   import javax.swing.*;
>   public class ButtonTest {
>     public static void main(String[] args) {
>       JFrame f = new JFrame("Button Test");
>       JButton myButton = new JButton("Test");
>       myButton.setBackground(Color.RED);
>       f.getContentPane().add(myButton);
>       f.pack();
>       f.setVisible(true);
>     }
>   }

It's not that bad:

(defpackage :button-gen
  (:use :common-lisp :jfli))

(in-package :button-gen)

(def-java-class "javax.swing.JFrame")
(def-java-class "javax.swing.JButton")
(def-java-class "java.awt.Container")
(def-java-class "java.awt.Color")

(defpackage :button
  (:use :common-lisp
        :jfli
        "javax.swing"
        "java.awt"))

(in-package :button)

(defvar *button* (jbutton.new "Test"))

(jbutton.setbackground *button* (color.red))

(let ((frame (jframe.new "Button test")))
  (container.add (jframe.getcontentpane frame) *button*)
  (jframe.pack frame)
  (jframe.setvisible frame t))

(jbutton.setbackground *button* (color.blue))

:-)

Andras
From: Christophe Turle
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <415912ec$0$11720$626a14ce@news.free.fr>
"Andras Simon" <······@math.bme.hu> a �crit dans le message de
····················@csusza.math.bme.hu...
> Frank Buss <··@frank-buss.de> writes:
>
> >
> > In Java Swing this is possible, but of course, not so nice with
> > interactive entering and exploring the commands:
> >
> >   import java.awt.*;
> >   import javax.swing.*;
> >   public class ButtonTest {
> >     public static void main(String[] args) {
> >       JFrame f = new JFrame("Button Test");
> >       JButton myButton = new JButton("Test");
> >       myButton.setBackground(Color.RED);
> >       f.getContentPane().add(myButton);
> >       f.pack();
> >       f.setVisible(true);
> >     }
> >   }
>
> It's not that bad:
>
> (defpackage :button-gen
>   (:use :common-lisp :jfli))
>
> (in-package :button-gen)
>
> (def-java-class "javax.swing.JFrame")
> (def-java-class "javax.swing.JButton")
> (def-java-class "java.awt.Container")
> (def-java-class "java.awt.Color")
>
> (defpackage :button
>   (:use :common-lisp
>         :jfli
>         "javax.swing"
>         "java.awt"))
>
> (in-package :button)
>
> (defvar *button* (jbutton.new "Test"))
>
> (jbutton.setbackground *button* (color.red))
>
> (let ((frame (jframe.new "Button test")))
>   (container.add (jframe.getcontentpane frame) *button*)
>   (jframe.pack frame)
>   (jframe.setvisible frame t))
>
> (jbutton.setbackground *button* (color.blue))
>
> :-)

what about :

> #J(compilation-unit
      (import java awt *)
      (import javax swing *)
      (class public ButtonTest
        (method public static void main ((array String) args)
          (var JFrame f (new JFrame ("Button Test")))
          (var JButton myButton (new JButton ("Test")))
          (call myButton setBackground Color.RED)
          (call (call f getContentPane) add myButton)
          (call f pack)
          (call f setVisible true) ))))

import java.awt.* ;
import javax.swing.* ;
public class ButtonTest
{
   public static void main( String[] args )
   {
      JFrame f = new JFrame( "Button Test" ) ;
      JButton myButton = new JButton( "Test" ) ;
      myButton.setBackground( Color.RED ) ;
      f.getContentPane().add( myButton ) ;
      f.pack() ;
      f.setVisible( true ) ;
   }
}


Christophe Turle.
From: Andras Simon
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <vcd8yau922b.fsf@csusza.math.bme.hu>
"Christophe Turle" <······@nospam.com> writes:

> "Andras Simon" <······@math.bme.hu> a �crit dans le message de
> ····················@csusza.math.bme.hu...
> > Frank Buss <··@frank-buss.de> writes:
> >
> > >
> > > In Java Swing this is possible, but of course, not so nice with
> > > interactive entering and exploring the commands:
> > >
> > >   import java.awt.*;
> > >   import javax.swing.*;
> > >   public class ButtonTest {
> > >     public static void main(String[] args) {
> > >       JFrame f = new JFrame("Button Test");
> > >       JButton myButton = new JButton("Test");
> > >       myButton.setBackground(Color.RED);
> > >       f.getContentPane().add(myButton);
> > >       f.pack();
> > >       f.setVisible(true);
> > >     }
> > >   }
> >
> > It's not that bad:
> >
> > (defpackage :button-gen
> >   (:use :common-lisp :jfli))
> >
> > (in-package :button-gen)
> >
> > (def-java-class "javax.swing.JFrame")
> > (def-java-class "javax.swing.JButton")
> > (def-java-class "java.awt.Container")
> > (def-java-class "java.awt.Color")
> >
> > (defpackage :button
> >   (:use :common-lisp
> >         :jfli
> >         "javax.swing"
> >         "java.awt"))
> >
> > (in-package :button)
> >
> > (defvar *button* (jbutton.new "Test"))
> >
> > (jbutton.setbackground *button* (color.red))
> >
> > (let ((frame (jframe.new "Button test")))
> >   (container.add (jframe.getcontentpane frame) *button*)
> >   (jframe.pack frame)
> >   (jframe.setvisible frame t))
> >
> > (jbutton.setbackground *button* (color.blue))
> >
> > :-)
> 
> what about :
> 
> > #J(compilation-unit
>       (import java awt *)
>       (import javax swing *)
>       (class public ButtonTest
>         (method public static void main ((array String) args)
>           (var JFrame f (new JFrame ("Button Test")))
>           (var JButton myButton (new JButton ("Test")))
>           (call myButton setBackground Color.RED)
>           (call (call f getContentPane) add myButton)
>           (call f pack)
>           (call f setVisible true) ))))
> 

How do you change the color of the button from the REPL? 
Note the (jbutton.setbackground *button* (color.blue)) above. 

My point was that you can use Swing _and_ have interactivity.

Andras
From: Christophe Turle
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <415ac691$0$22030$636a15ce@news.free.fr>
"Andras Simon" <······@math.bme.hu> a �crit dans le message de
····················@csusza.math.bme.hu...
> "Christophe Turle" <······@nospam.com> writes:
>
> > "Andras Simon" <······@math.bme.hu> a �crit dans le message de
> > ····················@csusza.math.bme.hu...
> > > Frank Buss <··@frank-buss.de> writes:
> > >
> > > >
> > > > In Java Swing this is possible, but of course, not so nice with
> > > > interactive entering and exploring the commands:
> > > >
> > > >   import java.awt.*;
> > > >   import javax.swing.*;
> > > >   public class ButtonTest {
> > > >     public static void main(String[] args) {
> > > >       JFrame f = new JFrame("Button Test");
> > > >       JButton myButton = new JButton("Test");
> > > >       myButton.setBackground(Color.RED);
> > > >       f.getContentPane().add(myButton);
> > > >       f.pack();
> > > >       f.setVisible(true);
> > > >     }
> > > >   }
> > >
> > > It's not that bad:
> > >
> > > (defpackage :button-gen
> > >   (:use :common-lisp :jfli))
> > >
> > > (in-package :button-gen)
> > >
> > > (def-java-class "javax.swing.JFrame")
> > > (def-java-class "javax.swing.JButton")
> > > (def-java-class "java.awt.Container")
> > > (def-java-class "java.awt.Color")
> > >
> > > (defpackage :button
> > >   (:use :common-lisp
> > >         :jfli
> > >         "javax.swing"
> > >         "java.awt"))
> > >
> > > (in-package :button)
> > >
> > > (defvar *button* (jbutton.new "Test"))
> > >
> > > (jbutton.setbackground *button* (color.red))
> > >
> > > (let ((frame (jframe.new "Button test")))
> > >   (container.add (jframe.getcontentpane frame) *button*)
> > >   (jframe.pack frame)
> > >   (jframe.setvisible frame t))
> > >
> > > (jbutton.setbackground *button* (color.blue))
> > >
> > > :-)
> >
> > what about :
> >
> > > #J(compilation-unit
> >       (import java awt *)
> >       (import javax swing *)
> >       (class public ButtonTest
> >         (method public static void main ((array String) args)
> >           (var JFrame f (new JFrame ("Button Test")))
> >           (var JButton myButton (new JButton ("Test")))
> >           (call myButton setBackground Color.RED)
> >           (call (call f getContentPane) add myButton)
> >           (call f pack)
> >           (call f setVisible true) ))))
> >
>
> How do you change the color of the button from the REPL?

If you mean how at the REPL you can dynamically change the
 color without needing to recompile the java code : sava can't.
 Sava is a java writer not a java interpreter.

> Note the (jbutton.setbackground *button* (color.blue)) above.
>
> My point was that you can use Swing _and_ have interactivity.

ok. I have just looked at the front java code.


Christophe Turle.
From: Adam Warner
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <pan.2004.09.28.07.50.45.547866@consulting.net.nz>
Hello Andras Simon,

> [...]
> (defpackage :button
>   (:use :common-lisp
>         :jfli
>         "javax.swing"
>         "java.awt"))
> [...]

Andras, can you please fix the world permissions on the SWT-related files
you mentioned in July:
<http://groups.google.co.nz/groups?selm=kleknhvztp.fsf%40hexagon.renyi.hu&output=gplain>

For example trying to access <http://www.math.bme.hu/~asimon/lisp/swt.cl>
produces this message:

   Forbidden
   You don't have permission to access /~asimon/lisp/swt.cl on this server.

   Apache/1.3.26 Ben-SSL/1.48 Server at www.math.bme.hu Port 80

I'm finally able to work upon building a GUI via ABCL, Java and Eclipse's
SWT widget set and I'm sure what you've already achieved will provide a
very helpful reference.

I prefer developing the GUI using a number of Lisps as I have found it can
greatly aid debugging (e.g. today I tracked down a bug in my code caused
by not supplying an :INITIAL-ELEMENT to ADJUST-ARRAY. I couldn't get the
code to run in SBCL and the error was obtuse so I tried CLISP and the code
worked. My code depended upon the new elements of the array being NIL.
CLISP happened to do this and it helped me track down my inadvertent
reliance upon implementation-specific behaviour). It appears jfli provides
the key to portably accessing any Java library.

Many thanks,
Adam
From: Andras Simon
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <vcd3c128za7.fsf@csusza.math.bme.hu>
Adam Warner <······@consulting.net.nz> writes:

> Hello Andras Simon,
> 
> > [...]
> > (defpackage :button
> >   (:use :common-lisp
> >         :jfli
> >         "javax.swing"
> >         "java.awt"))
> > [...]
> 
> Andras, can you please fix the world permissions on the SWT-related files
> you mentioned in July:
> <http://groups.google.co.nz/groups?selm=kleknhvztp.fsf%40hexagon.renyi.hu&output=gplain>
> 
> For example trying to access <http://www.math.bme.hu/~asimon/lisp/swt.cl>
> produces this message:
> 
>    Forbidden
>    You don't have permission to access /~asimon/lisp/swt.cl on this server.
> 
>    Apache/1.3.26 Ben-SSL/1.48 Server at www.math.bme.hu Port 80

This is intentional. (Sorry!) swt.cl uses my jparse Java<->Lisp
bridge, which I all but abandoned in favour of jfli. But the jfli'zed
version of the same swt example can be found in
http://www.math.bme.hu/~asimon/lisp/jfli-abcl.tar. See
http://groups.google.com/groups?selm=vcd4qma9glj.fsf%40csusza.math.bme.hu.
Caveat: I haven't got around to uploading the latest version of
jfli-abcl which incorporates fixes to jfli by Rich Hickey.

> I'm finally able to work upon building a GUI via ABCL, Java and Eclipse's
> SWT widget set and I'm sure what you've already achieved will provide a
> very helpful reference.

I hope you aren't using abcl's Java api. jfli is much more convenient,
and your code will (at least in principle, and unless you're using
jfli-abcl's NEW-CLASS macro) be portable between abcl and LW. But you
know this.

> I prefer developing the GUI using a number of Lisps as I have found it can
> greatly aid debugging (e.g. today I tracked down a bug in my code caused
> by not supplying an :INITIAL-ELEMENT to ADJUST-ARRAY. I couldn't get the
> code to run in SBCL and the error was obtuse so I tried CLISP and the code
> worked. My code depended upon the new elements of the array being NIL.
> CLISP happened to do this and it helped me track down my inadvertent
> reliance upon implementation-specific behaviour). 

I found that if something works in sbcl or abcl, it works
everywhere. cmucl and LW are much more generous when it comes to
strict ANSI compliance. 

>                                                It appears jfli provides
> the key to portably accessing any Java library.

I just hope that someone with the necessary ffi expertize will port it
to other implementations. And that people will start using it to
build Lisp libraries (as opposed to applications). E.g., an swt-based
capi in abcl/sbcl/cmucl/clisp/<your-favourite-cl-implementation-here>
would be really nice.

Andras
From: Adam Warner
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <pan.2004.09.28.12.34.06.282666@consulting.net.nz>
Hi Andras Simon,

> This is intentional. (Sorry!) swt.cl uses my jparse Java<->Lisp
> bridge, which I all but abandoned in favour of jfli. But the jfli'zed
> version of the same swt example can be found in
> http://www.math.bme.hu/~asimon/lisp/jfli-abcl.tar. See
> http://groups.google.com/groups?selm=vcd4qma9glj.fsf%40csusza.math.bme.hu.

Superb, thanks! jfli-abcl.lisp required a small fix to load (add :execute
to this eval-when):

(eval-when (:compile-toplevel :load-toplevel :execute)
                                             ^^^^^^^^
  (defun ensure-package (name)
    "find the package or create it if it doesn't exist"
    (or (find-package name)
        (make-package name :use '())))
  (intern "Object" (ensure-package "java.lang")) 
  (intern "String" (ensure-package "java.lang")))


Perhaps it's because I'm using Eclipse 3.0.1, these are the errors I get
when attempting to load swt9jfli.lisp:

Armed Bear Common Lisp 0.0.4+ (built Tue Sep 28 2004 22:04:34 NZST)
Java 1.5.0-rc Sun Microsystems Inc.
Java HotSpot(TM) Server VM
Low-level initialization completed in 2.396 seconds.
Startup completed in 8.139 seconds.
Type :HELP for a list of available commands.
CL-USER(1): (load "jfli-abcl.lisp")
T
CL-USER(2): (load "swt9jfli-gen.lisp")
T
CL-USER(3): (load "swt9jfli.lisp")
WARNING: proxy doesn't define:
dispose
WARNING: proxy doesn't define:
inputChanged
WARNING: proxy doesn't define:
dispose
WARNING: proxy doesn't define:
inputChanged
WARNING: proxy doesn't define:
dispose
WARNING: proxy doesn't define:
addListener
WARNING: proxy doesn't define:
removeListener
Error loading #P"/home/adam/t/jfli-abcl/examples/swt/swt9jfli.lisp" at line 113 (offset 3241).
Debugger invoked on condition of type ERROR:
  no such method: visit
Restarts:
  0: TOP-LEVEL Return to top level.
[1] SWT0(4):


Line 113 is the last line of this definition:

(new-class
 "SWT0.FileTreeLabelProvider" ;;class-name
 "org.eclipse.jface.viewers.LabelProvider" ;;super (may be a list of super & interfaces)
 () ;;constructors
 ( ;; methods
  ("getText" "java.lang.String" nil (element)
             (File.getName element))
  ("getImage" image. nil ((element "java.lang.Object"))
	      (if (File.isDirectory element)
		  (ImageRegistry.get (get-image-registry) "folder")
		  (ImageRegistry.get (get-image-registry) "file"))))
 () ;;fields
 )

Regards,
Adam
From: Andras Simon
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <vcdwtye7b4q.fsf@csusza.math.bme.hu>
Adam Warner <······@consulting.net.nz> writes:

> Hi Andras Simon,
> 
> > This is intentional. (Sorry!) swt.cl uses my jparse Java<->Lisp
> > bridge, which I all but abandoned in favour of jfli. But the jfli'zed
> > version of the same swt example can be found in
> > http://www.math.bme.hu/~asimon/lisp/jfli-abcl.tar. See
> > http://groups.google.com/groups?selm=vcd4qma9glj.fsf%40csusza.math.bme.hu.
> 
> Superb, thanks! jfli-abcl.lisp required a small fix to load (add :execute
> to this eval-when):
> 
> (eval-when (:compile-toplevel :load-toplevel :execute)
>                                              ^^^^^^^^

Thanks! 

> Perhaps it's because I'm using Eclipse 3.0.1, these are the errors I get
> when attempting to load swt9jfli.lisp:

Probably no. The warnings, like this:

> WARNING: proxy doesn't define:
> dispose

are expected (the only way to get rid of them is, well, to implement
the missing methods), but this

> Error loading #P"/home/adam/t/jfli-abcl/examples/swt/swt9jfli.lisp" at line 113 (offset 3241).
> Debugger invoked on condition of type ERROR:
>   no such method: visit
> Restarts:
>   0: TOP-LEVEL Return to top level.
> [1] SWT0(4):

is probably a sign of asm missing from your classpath. From the
README: 

     make sure that (1) asm.jar (http://asm.objectweb.org) is in your
     classpath

Does (jclass "org.objectweb.asm.ClassWriter") return normally? I hope
not, because if it does, then I must find a better excuse for this
error :-)

Andras
From: Adam Warner
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <pan.2004.09.28.22.33.32.747529@consulting.net.nz>
Hi Andras Simon,

>> Error loading #P"/home/adam/t/jfli-abcl/examples/swt/swt9jfli.lisp" at line 113 (offset 3241).
>> Debugger invoked on condition of type ERROR:
>>   no such method: visit
>> Restarts:
>>   0: TOP-LEVEL Return to top level.
>> [1] SWT0(4):
> 
> is probably a sign of asm missing from your classpath. From the
> README: 
> 
>      make sure that (1) asm.jar (http://asm.objectweb.org) is in your
>      classpath
> 
> Does (jclass "org.objectweb.asm.ClassWriter") return normally? I hope
> not, because if it does, then I must find a better excuse for this
> error :-)

I had followed your helpful instructions to the letter:

(jclass "org.objectweb.asm.ClassWriter")
=> #<JAVAOBJECT java.lang.Class @ #x102ae84>

Turns out the version I downloaded, 1.5.1, is incompatible:
<http://forge.objectweb.org/project/showfiles.php?group_id=23>

asm-1.5.jar is also incompatible. asm-1.4.3.jar is the first version
that worked.

Hear that, it worked! Thanks for the tip. This is the first time I've run
a beautiful (at least GTK 2.x is good looking ;-), cross platform GUI
within Common Lisp itself. The original poster should consider this as an
option "to write and deploy a GUI Lisp application on Windows".

Thanks,
Adam
From: Andras Simon
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <vcdoejp6mwh.fsf@csusza.math.bme.hu>
Adam Warner <······@consulting.net.nz> writes:

> I had followed your helpful instructions to the letter:
> 
> (jclass "org.objectweb.asm.ClassWriter")
> => #<JAVAOBJECT java.lang.Class @ #x102ae84>
> 
> Turns out the version I downloaded, 1.5.1, is incompatible:
> <http://forge.objectweb.org/project/showfiles.php?group_id=23>
> 
> asm-1.5.jar is also incompatible. asm-1.4.3.jar is the first version
> that worked.

Thanks for the detective work! I'll check in a fix for this in abcl later
today, and add a note to jfli-abcl's README.

> Hear that, it worked! Thanks for the tip. This is the first time I've run
> a beautiful (at least GTK 2.x is good looking ;-), cross platform GUI
> within Common Lisp itself. The original poster should consider this as an
> option "to write and deploy a GUI Lisp application on Windows".

GTK looks very decent indeed. Still, I wouldn't recommend using this
setup to anyone but my closest enemies. For one thing, officially
"abcl isn't really ready for use by anyone but its developers."
Besides, jfli isn't quite there either: to mention just one thing, it
doesn't give the user a way to deal with Java exceptions (maybe jfli
does, but jfli-abcl certainly does not). And even if all these
technical problems were fixed, one would still have to write a lot of
Java in Lisp; which is OK for the developer of a library but not of an
application, I think. 

This is not to say I wouldn't love to hear success stories!

Andras
From: Peter Herth
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <cj8o9g$nlu$1@newsreader2.netcologne.de>
vtail wrote:

> Hello everyone,
> 
> - My question:
> I want to write and deploy a GUI Lisp application on Windows - what is
> the best way to do that? Of course, measuring the "best way" may be
> different - portability, steepness of the learning curve, speed,
> usability etc.
> 


Hi, if you have some Python background, then I think Ltk is something
you should look at. If you have some experiences with Tkinter, Ltk should
come quite natural to you, it is free and the only prerequesite for using
it, is installing Tcl/Tk (you find binaries with installers at activestate
for example).
You can find Ltk here: http://www.peter-herth.de/ltk/

Peter

-- 
pet project: http://dawn.netcologne.de
homepage:    http://www.peter-herth.de
lisp stuff:  http://www.peter-herth.de/lisp.html
get Ltk here: http://www.peter-herth.de/ltk/
From: vtail
Subject: Re: Lisp newby: what is the shortest way to writing GUI lisp program on Windows?
Date: 
Message-ID: <9ff6b66.0410030722.6bdb1628@posting.google.com>
Thanks everybody for your advices.