Style specifies what happens when the collection is accessed with a key that does not exist
Member of Keyed Collection (PRIM_KCOL)
Data Type - Enumeration
The Style property specifies how the collection will handle references to objects that do not exist. By default, Keyed Collections will create object instances if the key is unknown. This is very useful for simple collection use, but it also means that objects cannot effectively be destroyed. The Style property specifies what happens when the collection is accessed with a key that does not exist in the collection. This property can have one of two values:
Enum Value | Description |
---|---|
Collection | Collection items must be created at run time and added to the collection |
Factory | Collection items are created when referenced |
In this example, the forms collection uses the default Style(Factory). The moment the form is referenced, it will be created and shown.
Define_Com Class(#Prim_kcol<#Prim_form #Std_num>) Name(#Forms) #Forms<123>.Showform
Here the collection uses Style(Collection). This requires that the instances be created by the user. If the 123 form cannot be found, a runtime error will be produced.
Define_Com Class(#Prim_kcol<#Prim_form #Std_num>) Name(#Forms) Style(Collection) #Forms<123>.Showform
Febuary 18 V14SP2