IupGetAttribute
Returns the name of an interface element attribute.
Parameters/Return
char *IupGetAttribute(Ihandle *ih, char *name); [in C] iup.GetAttribute(ih: ihandle, name: string) -> value: string [in Lua]
ih: Identifier of the interface element. If
NULL will retrieve from the global environment.
name: 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.
Inheritance
The attribute is first checked at the element specific implementation. If not defined then it checks in the attribute environment. If not defined in its attribute environment, the attribute will be inherited from its parent attribute environment 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).
IupLua
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).
Examples
See Also
IupSetAttribute, IupGetInt, IupGetFloat, IupSetAttributes, IupGetHandle.