Caution: This version of this document is no longer maintained. For the latest documentation, see


Function exported by PhAB to apply changes in the resource editor


int apply (
  PhABHandle_t phab,
  int n,
  void * value )


A handle, provided by PhAB as the phab argument when the plugin is created with ResPluginFrugalCreateF_t or ResPluginFullCreateF_t.
Resource data, depending on the data type.
Resource data, depending on the data type.


This function is exported from PhAB in the PhABResExportCommon_t structure.

This function is called from the plugin when resource data changes have to be applied to the selected widget or widgets, for example, when a user clicks the Apply button in the resource editor.

The data value is represented by the parameter pair n and value. How these parameters are passed depends on the data type of the resource. See the description of resource data types for a discussion of how these parameters are passed.

The return value of this function indicates whether PhAB has taken control over the resource data. This prevents memory leaks when the master copy rule applies. When the apply() function returns zero, PhAB has taken the given value and has made it the master copy. When the apply() function returns non zero, PhaB has not made the given value the master copy, it has used the default value instead. In this case the plugin should update its internal structures by freeing any data it allocated for the value and using the default value instead.


PhAB has made the resource data represented by value and n the master copy.
Non 0
PhAB has not made a master copy and is using the default value instead.



Interrupt handler No
Signal handler No
Thread No

See also:

PhABResExportCommon_t, ResPluginFrugalCreateF_t, ResPluginFullCreateF_t.