[comp.sys.mac.programmer] Alerts

ralph@computing-maths.cardiff.ac.uk (Ralph Martin) (01/11/89)

I don't know if this can be done, but here goes...

In the text for an alert, ^0,^1,^2,^3 are treated as special strings to be
replaced by ParamText. Believe it or not, I actually want the strings "^0"
and so on to appear in my alert, and not to be substituted.

Is there any way of escaping them or otherwise when specifying the text in
a .r file for Rez, so that they come out literally and are not substituted?

Or do I *have* to say something like ParamText("^0","^1","^2","^3"); ?

Ralph
-- 
Dr Ralph Martin
Department of Computing Mathematics
University of Wales College of Cardiff
PO Box 916
Cardiff
CF2 4YN
United Kingdom

sho@pur-phy (Sho Kuwamoto) (01/15/89)

In article <598@cf-cm.UUCP> ralph@computing-maths.cardiff.ac.uk (Ralph Martin) writes:
>I don't know if this can be done, but here goes...
>  [wants to use ^0 in dialog without substitution...]
>Or do I *have* to say something like ParamText("^0","^1","^2","^3"); ?

I have no idea how to do this, except for the fainly absurd, (like making
a PICT item that has a picture of your StatText) but I'm pretty sure that
even the above won't work.  ParamText("^0", "^1","^2","^3") will set up
an infinite loop, since that's the way ParamText works.

-Sho

jmunkki@kampi.hut.fi (Juri Munkki) (01/15/89)

In article <598@cf-cm.UUCP> ralph@computing-maths.cardiff.ac.uk (Ralph Martin) writes:
>... Believe it or not, I actually want the strings "^0"
>and so on to appear in my alert, and not to be substituted.
...
>... do I *have* to say something like ParamText("^0","^1","^2","^3"); ?

You can't do it that way. That will generate an infine recursion, since text
^0 contains text ^0 etc. This was done one purpose so that you could have
a paramtext that contains another parameter.

You can put a null (ASCII 0) between the two offending characters so that they
will not be recognized. I don't know if you can create the nul with Rez, but
you can do it with ResEdit by first writing some other character instead of
the null and then editing the DITL with the hex/ascii editor.

You might also try creating a PICT with the strings in it.

_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
|     Juri Munkki jmunkki@hut.fi  jmunkki@fingate.bitnet        I Want   Ne   |
|     Helsinki University of Technology Computing Centre        My Own   XT   |
~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~

shane@chablis.cc.umich.edu (Shane Looker) (01/15/89)

In article <598@cf-cm.UUCP> ralph@computing-maths.cardiff.ac.uk (Ralph Martin) writes:
>I don't know if this can be done, but here goes...
>
>In the text for an alert, ^0,^1,^2,^3 are treated as special strings to be
>replaced by ParamText. Believe it or not, I actually want the strings "^0"
>and so on to appear in my alert, and not to be substituted.
>
>Is there any way of escaping them or otherwise when specifying the text in
>a .r file for Rez, so that they come out literally and are not substituted?
>
>Or do I *have* to say something like ParamText("^0","^1","^2","^3"); ?
>
>Ralph

WHATEVER YOU DO, DO NOT PUT "^0", "^1", ETC	IN A STRING FOR SUBSTITUTION UNLESS
YOU REALLY KNOW WHAT YOU ARE DOING!!!!!!

There, now I'll explain why.  It is very easy to cause an infinite recursion
inside the toolbox by trying to substitute like this.  I know, I did it once.
The strings you pass in get re-expanded, and then re-parsed to check for any
of the special sequences (e.g. "^0".)  This is a great feature, but you can
have problems with it.

I would suggest putting a very narrow blank character between the "^" and the
number.



Shane Looker   |  Looker@um.cc.umich.edu
America works less, when you say "Union Yes!"

cremer@Apple.COM (Mike Cremer) (01/17/89)

In article <598@cf-cm.UUCP> Dr. Ralph Martin
(ralph@computing-maths.cardiff.ac.uk) writes:
> In the text for an alert, [...] I actually want the strings "^0"
> and so on to appear in my alert, and not to be substituted.

There is a simple way to get "^0" in a dialog/alert, though admittedly
it does burn *two* slots:

ParamText('^', '0', '', '');

This does work (I tried it before responding), so in conjunction
with some smart Concat's you ought to be able to get the message
you want.

Hope this helps.

$mike cremer

.............................. Tear Here ..............................

Apple Computer, Inc.               !  Internet: cremer@apple.com
20525 Mariani Ave. M/S 3M          !  UUCP: {amdcad,decwrl,sun}!apple!cremer
Cupertino, CA 95014                !  AppleLink: CREMER.M

"In a nutshell, sex is more fun than logic.  One cannot prove this,
but it IS, in the same sense that Mt. Everest IS, or that Al Macogan ISN'T.
Good night."
  - A Professional Logician, Python (Monty) Enterprises, Inc.