| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <html>
- <head>
- <title>Blitz3D Docs</title>
- <link rel=stylesheet href=../css/commands.css type=text/css>
- </head>
- <body>
- <h1>Insert</h1>
- <h1>Parameters</h1>
- <table>
- <tr>
- <td>
- None.
- </td>
- </tr>
- </table>
- <h1>Description</h1>
- <table>
- <tr>
- <td>
- I'm not sure the practical usage of this command, but basically, you can control where you INSERT the current TYPE object into the TYPE collection. When you create a new Type object with the NEW command, it is automatically appended to the END of the collection. Using INSERT along with BEFORE and AFTER (and electively FIRST and LAST) to put the Type object exactly where you want it. Sounds confusing - and chances are likely you'll never need this ability. But its here if you need it. Check the example.
- <br>
- <br>
- See also: <a class=small href=Type.htm>Type</a>, <a class=small href=New.htm>New</a>, <a class=small href=Before.htm>Before</a>, <a class=small href=After.htm>After</a>, <a class=small href=First.htm>First</a>, <a class=small href=Last.htm>Last</a>, <a class=small href=Each.htm>Each</a>, <a class=small href=Delete.htm>Delete</a>.
- </td>
- </tr>
- </table>
- <h1><a href=../2d_examples/Insert.bb>Example</a></h1>
- <table>
- <tr>
- <td>
- ; INSERT example
<br />
-
<br />
- ; Define a CHAIR type with a created field to track what order it was created in.
<br />
- Type CHAIR
<br />
- Field created
<br />
- End Type
<br />
-
<br />
- ; Create 10 chairs, setting created field to the order of creation
<br />
- For t = 1 To 10
<br />
- room.chair= New Chair
<br />
- room\created = t
<br />
- Next
<br />
-
<br />
- ; Make a NEW chair (the 11th)
<br />
- room.chair= New Chair
<br />
-
<br />
- ; Set its created value to 11
<br />
- room\created=11
<br />
-
<br />
- ; Now, let's insert this chair BEFORE the first one in the collection
<br />
- Insert room Before First Chair
<br />
-
<br />
- ; Let's iterate through all the chairs, and show their creation order
<br />
- For room.chair = Each chair
<br />
- Print room\created
<br />
- Next
- </td>
- </tr>
- </table>
- <br>
- <a target=_top href=../index.htm>Index</a><br>
- <br>
- Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Insert&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
- </html>
|