uidefault attribute

The [uidefault] attribute indicates that the type information member is the default member for display in the user interface.

[method-attribute-list, uidefault]return-type method-name(method-parameter-list)

Parameters

method-attribute-list

Other attributes that apply to the method.

return-type

The type of the data that the method will return when it finishes execution.

method-name

The name of the method.

method-parameter-list

Zero or more parameters for the method.

Remarks

Applying the [uidefault] attribute to a member of an interface or a dispinterface tells Visual Basic, at design-time, to automatically display this event or property to the user. This means that when the user double-clicks an object, Visual Basic jumps to the event in the default source interface that has the [uidefault] attribute. When the user selects an object, Visual Basic's Properties browser displays the property in the default source interface that has this attribute. If no event or property has the [uidefault] attribute, Visual Basic displays the first event or property listed in the default interface.

Typeflag Representation

The presence of FUNCFLAG_FUIDEFAULT or VARFLAG_FUIDEFAULT

Examples

[
    dual,
    uuid(12345678-1234-1234-1234-123456789ABC),
    restricted
]
interface IForm: IDispatch
{
    [propget]HRESULT Backcolor([out, retval] long *Value);
    [propput]HRESULT Backcolor([in] long Value);
    [propget, uidefault]HRESULT Name([out, retval] BSTR *Value);
    [propput, uidefault]HRESULT Name([in] BSTR Value);
}
[
    odl,
    dual,
    uuid(87654321-1234-1234-1234-123456789ABC),
    restricted
] 
interface IFormEvents: IDispatch
{
    [uidefault]HRESULT Click();
    HRESULT Resize();
}

[
    uuid(12345678-1234-1234-1234-987654321ABC)
]
coclass Form
{
    [default] interface IForm;
    [default, source] interface IFormEvents;
}

See also

Generating a Type Library With MIDL

ODL File Example

ODL File Syntax