[comp.sys.mac.hypercard] Printing Fields XCMD

leonardr@uxe.cso.uiuc.edu (03/23/88)

	I have been working on an XCMD that will allow you to print a Scrolling
Field in Hypercard.  I thought I had the little bugger done until, while
testing, I discovered that the GetField... calls all return handles to STRINGs
and not to text therefore limiting the fields to 255 chars.  So out the window
went all my previous code and it was back to the drawing board.
	My current solution (though not entirely working yet) is to use the
Open File and Write File commands in HyperTalk to write th file out to disk and
then call my XCMD with the name of the file.  The XCMD then reads the text file,
Prints it out and then deletes it (since it doesn't need to stay around).
	Does anyone have a better solution than this?  Has anyone already
written one of these and want to save me from more wasted time?  Dan, how
about some way to get a WHOLE FIELD back in that Handle instead of just a 
string??


+---------------------------------+-----------------------------------+
+                                 +  Any thing I say may be taken as  +
+   Leonard Rosenthol             +  fact, then again you might decide+
+   President, LazerWare, inc.    +  that it really isn't, so you     +
+                                 +  never know, do you??             +
+   leonardr@uxe.cso.uiuc.edu     +                                   +
+   GEnie:  MACgician             +                                   +
+   Delphi: MACgician             +                                   +
+                                 +                                   +
+---------------------------------+-----------------------------------+

aisl@ur-tut (Larry Landry) (03/26/88)

In article <220100010@uxe.cso.uiuc.edu> leonardr@uxe.cso.uiuc.edu writes:
>
> ...  discovered that the GetField... calls all return handles to STRINGs
>and not to text therefore limiting the fields to 255 chars.  So out the window
>went all my previous code and it was back to the drawing board.
>	My current solution (though not entirely working yet) is to use the
>Open File and Write File commands in HyperTalk to write th file out to disk and
>then call my XCMD with the name of the file.  The XCMD then reads the text file,
>	Does anyone have a better solution than this? ... 

Even though GetField will not do what you want, you can evaluate a 
HyperCard expression with the EvalExpr command.  This returns a handle 
to a zero terminated string.  Just evaluate "card field 3" or whatever
the field specification is.

Larry Landry
University of Rochester

edmoy@violet.berkeley.edu (03/26/88)

In article <220100010@uxe.cso.uiuc.edu> leonardr@uxe.cso.uiuc.edu writes:
>	I have been working on an XCMD that will allow you to print a Scrolling
>Field in Hypercard.  I thought I had the little bugger done until, while
>testing, I discovered that the GetField... calls all return handles to STRINGs
>and not to text therefore limiting the fields to 255 chars.  So out the window
>went all my previous code and it was back to the drawing board.

I've written a special purpose XCMD to dump all the fields of a stack in
a special format.  It does a GetFieldByName() on all fields and works
fine (I just tried it on a 648 character field).  The handle returned
is a handle to a null-terminated string (ala C string).  I'm using LSC and
the LSCXCM glue routines.

Edward Moy
Workstation Software Support Group
University of California
Berkeley, CA  94720

edmoy@violet.Berkeley.EDU
ucbvax!violet!edmoy

STORKEL@RICE.BITNET (Scott Storkel) (03/29/88)

My documentation says that the GetField... calls all return handles to zero
terminated strings, which means that you get the entire field. The docs I have
are not "official" and I haven't ever tried to use a GetField... call, but I
Have no reason to think they are wrong.

In any event, if GetField doesn't work, just pass the field you want to print
as a parameter to your XCMD. Such as:

              MyXCMD(card field 1)

This way, your XCMD or XFCN gets a handle to a zero terminated string
containing the contents of the field you passed to the routine. You can then
print the field, without having to call Hypercard to get its contents. This is
the method I would use.

Hope this helps,

Scott Storkel
Macintosh Software Development
Rice Unversity