IUP - Portable User Interface


Verifies the name of an interface element attribute.


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.


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.

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).


See Also

IupSetAttribute, IupGetInt, IupGetFloat, IupSetAttributes, IupGetHandle.