AttributeInfo

From Xojo Documentation

Revision as of 18:55, 19 November 2009 by WikiSysop (talk) (Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Description

Provides information on the attributes of an item via the Introspection system. You can add attributes for Project and Code Editor items in the IDE with the Attributes Editor.


Super Class

MemberInfo

Properties

Name Type Description
Name String The name of the attribute.
Value Variant The optional value of the attribute.


Notes

You create attributes for an object by right+clicking on the item in the Project Editor or the Code Editor and choosing Attributes... from the contextual menu. Enter the attribute Name in the first column and optionally a Value in the second column.

The identifiers "Deprecated" and "Hidden" are currently the only reserved Names.

For attributes of classes, attributes are inherited from the parent class and attribute values are overridden if redefined by the subclass.


Examples

Suppose Window1 has three attributes: The first attribute contains the Name only and the others have both a Name and Value:

Name Value
myName1
myName2 "Foo"
myName3 23

The following code retrieves the attributes and displays them in a ListBox:

Dim myAttributes() as Introspection.AttributeInfo = Introspection.GetType(window1).GetAttributes

For i as integer = 0 to Ubound(myAttributes)
ListBox1.AddRow myAttributes(i).Name
If (myAttributes(i).Value.isNull) then
ListBox1.Cell(ListBox1.LastIndex,1)="No Value"
Else
ListBox1.Cell(ListBox1.LastIndex,1=Str(myAttributes(i).Value)
End if
Next

See Also

ConstructorInfo, MemberInfo, MethodInfo, ObjectIterator, ParameterInfo, PropertyInfo, TypeInfo classes; Introspection module; GetTypeInfo function.