New (Stringlist constructor): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
No edit summary
 
(21 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:Stringlist:New subtitle}}
{{Template:Stringlist:New subtitle}}


This method returns a new instance of a <var>Stringlist</var>.  
This method returns a new instance of a <var>Stringlist</var>.
 
New is a constructor and as such can be called with no object, with an explicit class name, or with an object variable, even if that object is null:


==Syntax==
==Syntax==
Line 9: Line 7:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%sl </th>
<tr><th>%sl</th>
<td>A <var>Stringlist</var> object that is set to a new <var>Stringlist</var> object reference. </td></tr>
<td>A <var>Stringlist</var> object that is set to a new <var>Stringlist</var> object reference. </td></tr>
<tr><th>imagename </th>
<tr><th><var>[%(Stringlist):]</var></th>
<td>A string that contains the name of an image to be "associated" or "bound" to the '''%sl''' <var>Stringlist</var>. This is an optional argument.  ''This argument is case sensitive''. That is, in the likely event the User Language was written in mixed case, with automatic upper-casing in effect, the image name should be in uppercase (see [[Mixed-case User Language]].</td></tr>
<td>The optional class name in parentheses denotes a <var>[[Notation conventions for methods#Constructors|Constructor]]</var>.  See [[#Usage notes|"Usage notes"]], below, for more information about invoking a <var>Stringlist</var> <var>Constructor</var>.</td></tr>
<tr><th>imageName</th>
<td>An, optional, string that contains the name of an image to be "associated" or "bound" to the <var class="term">sl</var> <var>Stringlist</var>. This is an optional argument.  <b><i>This argument is case sensitive</i></b>. That is, in the likely event the <var class="product">User Language</var> was written in mixed case, with automatic upper-casing in effect, the image name should be in <b><i>uppercase</i></b> (see [[Mixed-case SOUL]]).</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li>All errors in New result in request cancellation.
<li>As described in [[Object variables#Using New or other Constructors|"Using New or other Constructors"]], <var>New</var> can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is <var>Null</var>:<p class="code">%sl = new
<li>Specifying an image name on the New method is identical to using a simple New with no parameters followed by a BindImage method on the new object:
 
%sl = %(Stringlist):new
 
%sl = %sl:new
</p>
<li>All errors in <var>New</var> result in request cancellation.</ul>
 
==Examples==
<ol><li><var>New</var> is a constructor and as such can be called with no object, with an explicit class name, or with an object variable, even if that object is null:
<p class="code">%sl = new
%sl = %(Stringlist):new
%sl = %sl:new
</p>
<li>Specifying an image name on the <var>New</var> method is identical to using a simple <var>New</var> with no parameters followed by a <var>[[BindImage (Stringlist subroutine)|BindImage]]</var> method on the new object:


<pre>
<p class="code">%list = new('IMAGENAME')
%list = new('IMAGENAME')
</p>
</pre>


is equivalent to
is equivalent to


<pre>
<p class="code">%list = new
%list = new
%list:bindImage('IMAGENAME')
%list:bindImage('IMAGENAME')
</pre>
</p>


For more information about the association or binding of an image to a <var>Stringlist</var>, see [[Bindiamge (Stringlist function)]].</ul>
</ol>


[[Category:Stringlist methods|New constructor]]
==See also==
For more information about the association or binding of an image to a <var>Stringlist</var>, see <var>[[BindImage (Stringlist subroutine)|BindImage]]</var>.
{{Template:Stringlist:New footer}}

Latest revision as of 21:52, 22 January 2015

Create new Stringlist instance (Stringlist class)


This method returns a new instance of a Stringlist.

Syntax

%sl = [%(Stringlist):]New[( [imageName])]

Syntax terms

%sl A Stringlist object that is set to a new Stringlist object reference.
[%(Stringlist):] The optional class name in parentheses denotes a Constructor. See "Usage notes", below, for more information about invoking a Stringlist Constructor.
imageName An, optional, string that contains the name of an image to be "associated" or "bound" to the sl Stringlist. This is an optional argument. This argument is case sensitive. That is, in the likely event the User Language was written in mixed case, with automatic upper-casing in effect, the image name should be in uppercase (see Mixed-case SOUL).

Usage notes

  • As described in "Using New or other Constructors", New can be invoked with no object, with an explicit class name, or with an object variable in the class, even if that object is Null:

    %sl = new %sl = %(Stringlist):new %sl = %sl:new

  • All errors in New result in request cancellation.

Examples

  1. New is a constructor and as such can be called with no object, with an explicit class name, or with an object variable, even if that object is null:

    %sl = new %sl = %(Stringlist):new %sl = %sl:new

  2. Specifying an image name on the New method is identical to using a simple New with no parameters followed by a BindImage method on the new object:

    %list = new('IMAGENAME')

    is equivalent to

    %list = new %list:bindImage('IMAGENAME')

See also

For more information about the association or binding of an image to a Stringlist, see BindImage.