IupGetAttribute

IUP - Portable User Interface

IupGetAttribute

Verifies the name of an interface element attribute.

Parameters/Return

char *IupGetAttribute(Ihandle *element, char *a); [in C]
IupGetAttribute(element: iuplua_tag, a: string) -> value: string [in IupLua3]
iup.GetAttribute(element: iuplua_tag, a: string) -> value: string [in IupLua5]

element: Identifier of the interface element.
a: name of the attribute.

This function returns attribute’s value. If the attribute does not exist, NULL (nil in IupLua) is returned.

Notes

This function’s return value is not necessarily the same one used by the application to define the attribute’s value. The subsequent call to the IupGetAttribute function may change the contents of the previously returned pointer, as this is an internal IUP buffer. The user is in charge of storing the value before calling any other IUP function.

The user has to understand that there is a difference between IUP attributes, such as VALUE or SIZE, and those stored for the user. The IUP attributes are often dynamically computed, stored in a temporary buffer and returned for the user to have access to the values. In the case of attributes stored for the user, the pointer returned by IupGetAttribute will be the same as the stored pointer, allowing the contents to be changed.

The pointers of internal IUP attributes returned by IupGetAttribute must never be freed or changed.

The attribute is first checked at the element specific implementation at the driver (if mapped) or at the custom control. If not defined then it checks in the hash table. If not defined in its hash table, the attribute will be inherited from its parent and so forth, until it reaches the dialog. But if still then the attribute is not defined a default value for the element is returned (the default value can also be NULL).

In IupLua, only known internal pointer attributes are returned as user data, all other attributes are returned as strings. To access attribute data always as user data use IupGetAttributeData (Lua 3) and iup.GetAttributeData (Lua 5).

Example

See Also

IupSetAttribute, IupGetInt, IupGetFloat, IupSetAttributes, IupGetHandle.