Class FormMenuArray
- Namespace
- RDCore.Forms.Menus
- Assembly
- RDCore.Forms.dll
A menu array: the items 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.
public sealed class FormMenuArray : IEnumerable<FormMenuItem>, IEnumerable
- Inheritance
-
FormMenuArray
- 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. They are in the same menu, or all on the menu bar.
Load(int) places a new element among the others in the order of their indexes: after the one with the highest index below
its own, or, with none below, before the one with the lowest index above. It copies the element that has the lowest index:
its Caption, Checked, Enabled, Visible, Tag and HelpContextID, as measured with VB6,
and its CheckOnClick and Picture, RDForms' own. It does not copy its Shortcut, its WindowList or the
items of its menu, so a copy of a menu is an item that opens none.
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<FormMenuItem> Elements { get; }
Property Value
this[int]
The element that has an index.
public FormMenuItem this[int index] { get; }
Parameters
indexintThe element's index.
Property Value
- FormMenuItem
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.
Menu
The form's menus the array is part of.
public FormMenu Menu { get; }
Property Value
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, in the order of their indexes, as a program's For Each goes through them.
public IEnumerator<FormMenuItem> GetEnumerator()
Returns
- IEnumerator<FormMenuItem>
The enumerator.
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 ItemLoaded.
public FormMenuItem Load(int index)
Parameters
indexintThe new element's index.
Returns
- FormMenuItem
The element loaded.
Exceptions
- FormErrorException
indexis negative: 341, Invalid object array index. It is above 32767: 6, Overflow. An element of that index is loaded: 360, Object already loaded. Nothing changes.
Unload(int)
Unloads an element a program loaded, as a program's Unload statement does, and raises ItemUnloaded.
public void Unload(int index)
Parameters
indexintThe element's index.
Remarks
The last visible item of the menu bar can be unloaded, and the bar goes with it.
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. It is the only visible item of its menu: 361, Can't load or unload this object. Nothing changes.