Class FormControlArray
- Namespace
- RDCore.Forms.Model
- Assembly
- RDCore.Forms.dll
A control array: the controls of a form that share a name and each have an index, with the members and the rules VB6 has for them at run time. Menu items are in menu arrays (FormMenuArray).
public sealed class FormControlArray : IEnumerable<ComponentInstance>, IEnumerable
- Inheritance
-
FormControlArray
- Implements
- Inherited Members
Remarks
The elements are read from the form each time they are asked for, so those of the form's file and those a program loads are one array.
Load(int) copies the element that has the lowest index, with the values it has at the time: every property set on it but
Visible, which is false, and TabIndex, which is the next after the form's others. The copy is placed
in the same container, last, and it holds none of the controls the element holds. A program's Controls collection has it after
the controls of the form's file, in the order the program loaded it (Controls).
Properties
Count
How many elements are loaded.
public int Count { get; }
Property Value
Elements
The elements loaded, in the order of their indexes.
public IReadOnlyList<ComponentInstance> Elements { get; }
Property Value
Form
The form the array is part of.
public FormDefinition Form { get; }
Property Value
this[int]
The element that has an index.
public ComponentInstance this[int index] { get; }
Parameters
indexintThe element's index.
Property Value
- ComponentInstance
The element.
Exceptions
- FormErrorException
No element of that index is loaded: 340, Control array element doesn't exist.
LBound
The lowest index of an element loaded.
public int LBound { get; }
Property Value
Exceptions
- FormErrorException
No element is loaded: 340.
Name
The array's name: its elements'.
public string Name { get; }
Property Value
UBound
The highest index of an element loaded.
public int UBound { get; }
Property Value
Exceptions
- FormErrorException
No element is loaded: 340.
Methods
GetEnumerator()
The elements loaded when the enumeration starts, in the order of their indexes, as a program's For Each goes over them.
public IEnumerator<ComponentInstance> GetEnumerator()
Returns
- IEnumerator<ComponentInstance>
An enumerator of the elements.
IsLoaded(int)
Whether an element of an index is loaded.
public bool IsLoaded(int index)
Parameters
indexintThe index.
Returns
Load(int)
Loads a new element, as a program's Load statement does, and raises ControlAdded.
public ComponentInstance Load(int index)
Parameters
indexintThe new element's index.
Returns
- ComponentInstance
The element loaded.
Exceptions
- FormErrorException
indexis negative: 341, Invalid control array index. It is above 32767: 6, Overflow. An element of that index is loaded: 360, Object already loaded. No element is loaded to copy (the form has none of the array's name left): 340. Nothing changes.
Unload(int)
Unloads an element a program loaded, as a program's Unload statement does, and raises ControlRemoved.
The form's other TabIndex values close up over the element's.
public void Unload(int index)
Parameters
indexintThe element's index.
Exceptions
- FormErrorException
No element of that index is loaded: 340, Control array element doesn't exist. The element is one of the form's file: 362, Can't unload controls created at design time. Nothing changes.