ParamText
ParamText
Assign text to static item ^n text variables void ParamText(param0, param1, param2, param3 ); Str255 param0 ; address of Pascal string to replace ^0 Str255 param1 ; address of Pascal string to replace ^1 Str255 param2 ; address of Pascal string to replace ^2 Str255 param3 ; address of Pascal string to replace ^3 ParamText sets the values to be used when a dialog or alert contains a static text item that includes a "text replacement variable" ^0, ^1, ^2, or ^3. It
should be called before displaying a dialog or alert containing such variables.
param0 through . . .
param3 are the addresses of pascal-style length-prefixed strings. A value
of "\p" or NIL can be used for strings that won't be needed.
Notes: ParamText, and the ability of the Dialog Manager to use ^n replacement text variables, lets you easily change the text of statText items in a dialog
or alert. This is much simpler than creating a variety of dialog resources
or manually tracking down and changing dialog text via GetDItem and For instance, if you have a statText item that is defined as:
Save "^0" before quitting?
and the variable curFileName contains the pascal string "\pMyDocument",
then after using:
the dialog will display:
Save "MyDocument" before quitting?
Note: The circumflex ( ^) is the literal character ASCII 94 (0x5E). The string " ^0" is two characters (0x5E and 0x30); it is NOT to be read as
" control-zero" or " control-oh".
One useful technique is to create an alert with a statText item containing
just the text ^0^1^2^3". This lets you use ParamText to define the entire text displayed by the alert-on the fly.
handles beginning at global address DAStrings (at 0xAA0) are handles to the
current text of the four ^n variables.
This technique cannot be used to change the titles of controls. Use
Since static text can be displayed in a font other than Chicago (see
SetDAFont), you can use ^n variables in positions where the control titles would go.
Each of the parameter strings may be up to 255 characters and the Dialog
Manager performs wordwrap (àla TextEdit) to fit the expanded text of a
static item into its enclosing rectangle. CRs (0x0D) in the text force a
newline.