IupSetAttributes

IUP - Portable User Interface

IupSetAttributes

Defines a set of attributes for an interface element. This function keeps a copy of the attributesÂ’ parameters.

Parameters/Return

Ihandle *IupSetAttributes(Ihandle *element, char *attributes); [in C]
IupSetAttributes(element: iulua_tag, attributes: string) -> elem: iulua_tag [in IupLua3]
iup.SetAttributes(element: iulua_tag, attributes: string) -> elem: iulua_tag [in IupLua5] 

element: Identifier of the interface element.
attributes: in the form v1=a1, v2=a2,... where vi is the name of an attribute and ai is its value.

This function returns element if all attributes were defined, or NULL (nil in Lua) otherwise.

Notes

It is worth noting that, in this function, the names of the attributes recognized by IUP cannot be defined with the prefix IUP_.

This function returns the same Ihandle it receives. This way, it is a lot easier to create dialogs in C. For example:

dialog = IupSetAttributes(
  IupDialog(
    IupVBox(
      IupSetAttributes(IupFill(), "SIZE = 5"),
      IupHBox(
        IupSetAttributes(IupFill(), "SIZE = 5"),
        canvas = IupSetAttributes(IupCanvas("repaind_cb"), "BORDER=NO, RASTERSIZE=100x100"),
        IupSetAttributes(IupFill(), "SIZE = 5"),
        NULL),
      IupSetAttributes(IupFill(), "SIZE = 5"),
      NULL)), 
  "TITLE = Teste")

Example

Creates a list with country names and defines Japan as the selected option.

In C

Ihandle *lista = IupList ("acao_lista");
IupSetAttributes(lista,"VALUE=3,1=Brazil,2=USA,3=Japan,4=France");

See Also

IupGetAttribute, IupSetAttribute, IupGetAttributes, IupStoreAttribute