上等兵
UID2007123
U币0
G币99
技术0
主题2
精华0
阅读权限20
注册时间2012-3-31
最后登录2016-10-14
在线时间4 小时
上等兵
|
一线天001 发表于 2012-8-14 20:43
int DUANLIANG_constructor_cb ( int dialog_id,
void * client_data,
UF_S ...
下面是ok按钮的回调函数
int DUANLIANG_ok_cb ( int dialog_id,
void * client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
/* Make sure User Function is available. */
if ( UF_initialize() != 0)
return ( UF_UI_CB_CONTINUE_DIALOG );
/* ---- Enter your callback code here ----- */
double Lenth;
double Hight;
double Width;
double H1;
double R;
double L;
double thick_a;
double thick_b;
double thick_c;
double thick_d;
char exps_string[10][20];
UF_STYLER_item_value_type_t data[10];
data[0].item_attr=UF_STYLER_VALUE;
data[0].item_id=DUANLIANG_LENTH;
UF_STYLER_ask_value(dialog_id,&data[0]);
data[1].item_attr=UF_STYLER_VALUE;
data[1].item_id=DUANLIANG_HIGHT;
UF_STYLER_ask_value(dialog_id,&data[1]);
data[2].item_attr=UF_STYLER_VALUE;
data[2].item_id=DUANLIANG_WIDTH;
UF_STYLER_ask_value(dialog_id,&data[2]);
data[3].item_attr=UF_STYLER_VALUE;
data[3].item_id=DUANLIANG_H1;
UF_STYLER_ask_value(dialog_id,&data[3]);
data[4].item_attr=UF_STYLER_VALUE;
data[4].item_id=DUANLIANG_R;
UF_STYLER_ask_value(dialog_id,&data[4]);
data[5].item_attr=UF_STYLER_VALUE;
data[5].item_id=DUANLIANG_L;
UF_STYLER_ask_value(dialog_id,&data[5]);
data[6].item_attr=UF_STYLER_VALUE;
data[6].item_id=DUANLIANG_THICK_A;
UF_STYLER_ask_value(dialog_id,&data[6]);
data[7].item_attr=UF_STYLER_VALUE;
data[7].item_id=DUANLIANG_THICK_B;
UF_STYLER_ask_value(dialog_id,&data[7]);
data[8].item_attr=UF_STYLER_VALUE;
data[8].item_id=DUANLIANG_THICK_C;
UF_STYLER_ask_value(dialog_id,&data[8]);
data[9].item_attr=UF_STYLER_VALUE;
data[9].item_id=DUANLIANG_THICK_D;
UF_STYLER_ask_value(dialog_id,&data[9]);
Lenth=data[0].value.real;
Hight=data[1].value.real;
Width=data[2].value.real;
H1=data[3].value.real;
R=data[4].value.real;
L=data[5].value.real;
thick_a=data[6].value.real;
thick_b=data[7].value.real;
thick_c=data[8].value.real;
thick_d=data[9].value.real;
for(int i=0;i<10;i++)
{
UF_STYLER_free_value(&data);
}
//修改表达式的值
sprintf(exps_string[0],"Lenth=%f",Lenth);
sprintf(exps_string[1],"Hight=%f",Hight);
sprintf(exps_string[2],"Width=%d",Width);
sprintf(exps_string[3],"H1=%f",H1);
sprintf(exps_string[4],"R=%f",R);
sprintf(exps_string[5],"L=%f",L);
sprintf(exps_string[6],"thick_a=%f",thick_a);
sprintf(exps_string[7],"thick_b=%f",thick_b);
sprintf(exps_string[8],"thick_c=%f",thick_c);
sprintf(exps_string[9],"thick_d=%f",thick_d);
//更新模型
for(int j=0;j<10;j++)
{
UF_MODL_edit_exp(exps_string[j]);
UF_MODL_update();
}
UF_terminate ();
/* Callback acknowledged, terminate dialog */
/* It is STRONGLY recommended that you exit your */
/* callback with UF_UI_CB_EXIT_DIALOG in a ok callback.*/
/* return ( UF_UI_CB_EXIT_DIALOG ); */
return (UF_UI_CB_EXIT_DIALOG);
}
|
|