第二种:
static UF_STYLER_callback_info_t CHANGE_cbs[CHANGE_CB_COUNT] =
{
{UF_STYLER_DIALOG_INDEX, UF_STYLER_OK_CB , 0, CHANGE_OnOk},
{UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB , 0, CHANGE_apply_cb},
{CHANGE_ACTION_0 , UF_STYLER_ACTIVATE_CB , 0, CHANGE_CreateNewPart},
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
};
static UF_MB_styler_actions_t actions[] = {
{ "NewPart.dlg", NULL, CHANGE_cbs, UF_MB_STYLER_IS_NOT_TOP },
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */
};
int CHANGE_CreateNewPart ( 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 ----- */
uc1601("OnButton_CreatePart",1);
char partName[]="d:\\test.prt";
tag_t partTag;
UF_PART_new(partName,1,&partTag);
if(partTag==NULL_TAG)
{
uc1601("false!",1);
}
UF_terminate ();
/* Callback acknowledged, do not terminate dialog */
return (UF_UI_CB_CONTINUE_DIALOG);
/* or Callback acknowledged, terminate dialog. */
/* return ( UF_UI_CB_EXIT_DIALOG ); */
} |