From: "David Herron" <david@twg.com>
Subject: Re: tk widgets from Motif libs?
Sensitivity: Personal
Encoding:  82 TEXT , 4 TEXT 
Conversion: Prohibited
Organization: The Wollongong Group, Inc., Palo Alto, CA
Conversion-With-Loss: Prohibited
Date: Thu, 30 Jul 1992 18:50:36 GMT

> Have tk widgets ever been built from the Motif libraries?  If not,
> what would be involved in doing this?

Do you mean to ask:  "Has a tk-like programming interface to Motif widgets
been built?"

If so.. I'm not sure this is possible.  The concepts do not seem to map
very well.  Geometry management with Motif is wildly different than
with TK, for instance.

What I have been looking at (infrequently) is to bring the Xlib/Xt/Motif
programming calls out to TCL.  This serves my purposes more closely as
it will help with prototyping/building Motif applications.  I am starting
with a package someone (forget who) wrote for Perl to do the same thing.

The package includes a set of template files describing all the procedure
calls in Xlib on-up.  A template looks something like a procedure definition
along with a list of parameters and types.  There is room for giving default
values for local variables, and specifying extra code to call.  There is a perl 
script which converts these templates into a `command procedure' which parses
the argument list to get the input values, calls the procedure, and encodes
the output values into perl variables.

So far I have played with the perl script to make it generate code suitable
for use within TCL.  Not all of this is finished.  Also come of the code
snippets in the template files work within perl, and will have to be rewritten
for TCL.

Things left to do:

- Have a way to specify Xt style argument lists.  Something like

	{ {XmNwidth 50} {XmNheight 60} ... }

  would be hunky-dory.

  So there'll need to be a procedure somewhere to map resource names into
  their proper value.  Also a number of procedures to convert the string
  form of the resource value into the internal value.  Fortunately for
  the latter, Xt already has converter routines for this purpose.  Hopefully
  they aren't too strictly focused on parsing resource files ;-).

- The template file approach does *nothing* for manipulating the contents
  of a data structure.  I don't know what this guy did in Perl, but it was
  probably ugly things with PACK and UNPACK ;-).  Also, to return a pointer
  to a data structure (say, a Widget), it converts the pointer value into
  a decimal string and passes that back to the calling script!  To make a
  call using that widget you pass the decimal string back to the interpreter.

  Well, shoot..  Surely we can generate a `handle', then for some/all the data
  types specify some procedures which take that handle.

- Should it provide access to the Xt event mechanism?  Should callback routines
  go directly to a TCL script?  If so, what about the EVENT structure passed
  to the callback routine?

- There must be more ..




A couple of related things:

- wafe tread upon similar ground.  I looked at it and came away under impressed,
  but don't remember why.  The part where it would run a perl script as a
  a seperate process and send commands to wafe through a pipe is a definite
  weirdity and shouldn't be necessary.

  Don't remember where to get it ;-(

- There is a commercial product called ezX available from Sunrise Software.
  On the glossy sheet is a paragraph:

	Any interpreted language can be used to control the behavior
	of windows and widgets.  Common languages such as Tcl, BASIC or PROLOG
	can be used or a custom language defined and integrated by
	the end user.

  And when I was talking with the guy at Xhibition he implied that they had
  some sort of interface from Tcl to Motif, but did not get a good impression
  of what he meant.  Anybody know?


<- David Herron <david@twg.com>, Just: Another E-Mail hacker ...
<-
<- As for the prevalence of gratuitous stupidity in modern life, well,
<- need I say more than "MS-DOS"? -- Bill Janssen
Newsgroups: comp.lang.tcl