Chapter 2 Hello, World

2.1 Your First AM2 Program

So follow along now and type in the following lines using your favorite text editor.
HelloWorld.adl
anonymous: XFtop

{

XFbutton button {

label = "Hello, world";

Pressed = {'Exit, theApp};

};

} top {

height = button.height;

width = button.width;

};

If you have installed AthenaMuse correctly, you should now be able to type

% am2Program hello.adl

To run this sample program, where am2Program is the name of the AthenaMuse executable on your system. The result should be a small frame containing a single button labelled "Hello, World".[2] If you click on the button, the program exits and the frame disappears. All right. It may not be the most exciting program, but in a very few lines of code you have implemented a well-behaved application that creates a window button with which you can interact. Let's look at the code line by line to see how it works.


[2] On Windows, this frame appears in the upper left corner of the screen. On UNIX, its location depends on your window manager. Many window managers allow the application to "float" as an outline box until you click to position it.
% am2Program hello.adl

AM2 Documentation - 19 NOV 1996

Generated with Harlequin WebMaker