using void * client_data
example
-----> in the main function
double *ptr;
ptr = (double *)malloc(sizeof(double));
spark_gap([$response, ptr)]
------> call function to create dialog
extern int spark_gap ( int *response, double *ptr)
{
int error_code = 0;
if ( ( error_code = UF_initialize() ) != 0 )
return (0) ;
if ( ( error_code = UF_STYLER_create_dialog ( "sparkgap.dlg",
SP_cbs, /* Callbacks from dialog */
SP_CB_COUNT, /* number of callbacks*/
ptr, /* This is your client data */
response ) ) != 0 )
{
char fail_message[133];
UF_get_fail_message(error_code, fail_message);
UF_UI_set_status (fail_message);
}
----------------dialog ok callback----------------------------------------
int SP_ok_cb ( int dialog_id,
void * client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
data.item_id = SP_REAL_0;
data.item_attr = UF_STYLER_VALUE;
UF_STYLER_ask_value(dialog_id, [$data)]
*(double *)client_data = data.value.real;
} |