Difference between revisions of "Runtime"

From Xojo Documentation

(Examples)
 
(2 intermediate revisions by the same user not shown)
Line 20: Line 20:
  
 
==Examples==
 
==Examples==
The following code displays the properties related to individual objects in a multicolumn [[ListBox]] and the total amount of memory used in a [[TextField]]:
+
The following code displays the properties related to individual objects in a multicolumn [[DesktopListBox|ListBox]] and the total amount of memory used in a [[DesktopTextField|TextField]]:
  
 
<rbcode>
 
<rbcode>
Line 26: Line 26:
 
For i As Integer = 0 To lastObjectIndex
 
For i As Integer = 0 To lastObjectIndex
 
   Listbox1.AddRow(Runtime.ObjectID(i).ToString)
 
   Listbox1.AddRow(Runtime.ObjectID(i).ToString)
   Listbox1.CellValueAt(ListBox1.LastAddedRowIndex, 1) = Runtime.ObjectClass(i)
+
   Listbox1.CellTextAt(ListBox1.LastAddedRowIndex, 1) = Runtime.ObjectClass(i)
   Listbox1.CellValueAt(ListBox1.LastAddedRowIndex, 2) = Runtime.ObjectRefs(i).ToString
+
   Listbox1.CellTextAt(ListBox1.LastAddedRowIndex, 2) = Runtime.ObjectRefs(i).ToString
 
Next
 
Next
TextField1.Value = Str(Runtime.MemoryUsed)
+
TextField1.Text = Runtime.MemoryUsed.ToString
 
</rbcode>
 
</rbcode>
  

Latest revision as of 21:00, 13 February 2022

Module

Returns information about the current state of the runtime environment. This information can be useful for debugging purposes.

Properties
MemoryUsed fa-lock-32.png ObjectCount fa-lock-32.png ObjectRefs fa-lock-32.png
ObjectClass fa-lock-32.png ObjectID fa-lock-32.png


Methods
IterateObjects

Examples

The following code displays the properties related to individual objects in a multicolumn ListBox and the total amount of memory used in a TextField:

Var lastObjectIndex As Integer = Runtime.ObjectCount - 1
For i As Integer = 0 To lastObjectIndex
Listbox1.AddRow(Runtime.ObjectID(i).ToString)
Listbox1.CellTextAt(ListBox1.LastAddedRowIndex, 1) = Runtime.ObjectClass(i)
Listbox1.CellTextAt(ListBox1.LastAddedRowIndex, 2) = Runtime.ObjectRefs(i).ToString
Next
TextField1.Text = Runtime.MemoryUsed.ToString

See Also

ObjectIterator class; System module.