Subject: ANNOUNCE: X11::Motif 1.1 beta
From: [email-masked] (Ken Fox)
Date: 31 Jan 1998 15:21:51 GMT
Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules

The first beta release of the X11::Motif module has been added
to CPAN today.  (Please allow some time for it to be mirrored.)
The module is available as:

  file: $CPAN/authors/id/KENFOX/X11-Motif-1.1b1.tar.gz
  size: 111643 bytes
   md5: 5f2bc908bf14c831ece4e006070b6c30

The X11::Motif distribution includes X11::Lib and X11::Toolkit.
Taken together, these modules provide a nearly complete
interface to the standard X libraries.  The modules have both
object oriented and function call style interfaces.  The object
interface is similar to the Tk module.  The function call
interface is strongly modeled after the standard X library
documentation and will be familiar to someone with X Toolkit or
Motif experience.

I've included two versions of the classic "hello world" example
at the end of this announcement.  Even if you don't grab the module,
I'd appreciate feedback on whether the example is understandable.

To build the modules, you will need:

  * Perl version 5.004 or higher
  * X11R5 or higher (X11R4 should work but hasn't been tested)
  * Motif 1.2.4 or higher (CDE Motif works.  Motif 2.0 is reported
    to work.  LessTif is also reported to work, but with reduced
    functionality.)
  * An ANSI C compiler

I would appreciate being notified of any changes necessary to
support other environments and/or widget sets.

The modules work well in both stand-alone scripts and when embedded
in a larger C-based Motif application.

Any questions or comments?  Please send them to <[email-masked]>.

- Ken

# ----------------------------------------------------------------------
# -- Example #1: The object style

use X11::Motif;

my $toplevel = X::Toolkit::initialize("Example");

my $form = give $toplevel -Form;
my $hello = give $form -Label, -text => 'Hello, world!';
my $ok = give $form -Button, -text => 'OK', -command => sub { exit };

arrange $form -fill => 'xy', -bottom => [ $ok, $hello ];

handle $toplevel;

# ----------------------------------------------------------------------
# -- Example #2: The function call style (i.e. "traditional" Motif)

use X11::Motif qw(:Xt :Xm);

my $toplevel = X::Toolkit::initialize("Example");

my $form = XtCreateManagedWidget("form", xmFormWidgetClass, $toplevel);

my $hello = XtCreateManagedWidget("hello", xmLabelWidgetClass, $form,
				    XmNlabelString, "Hello, world!",
				    XmNlabelType, XmSTRING);

my $ok = XtCreateManagedWidget("ok", xmPushButtonWidgetClass, $form,
				    XmNlabelString, "OK",
				    XmNlabelType, XmSTRING);

XtAddCallback($ok, XmNactivateCallback, sub { exit }, 0);

XtSetValues($hello,
		XmNrightAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_FORM,
		XmNtopAttachment, XmATTACH_FORM,
		XmNbottomAttachment, XmATTACH_WIDGET,
		XmNbottomWidget, $ok);

XtSetValues($ok,
		XmNrightAttachment, XmATTACH_FORM,
		XmNleftAttachment, XmATTACH_FORM,
		XmNtopAttachment, XmATTACH_NONE,
		XmNbottomAttachment, XmATTACH_FORM);

XtRealizeWidget($toplevel);
XtAppMainLoop(XtWidgetToApplicationContext($toplevel));