标题: ug open api 关于UIStyler中控件的初始值问题【对你们来说应该是基础问题】 [打印本页] 作者: 63455 时间: 2012-3-22 21:07 标题: ug open api 关于UIStyler中控件的初始值问题【对你们来说应该是基础问题】 ug open api 关于UIStyler中控件的初始值问题【对你们来说应该是基础问题】
/* These include files are needed for the following template code. */
#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_exit.h>
#include <uf_ui.h>
#include <uf_styler.h>
#include <uf_mb.h>
#include <F:\MGNX_C++\UG_CFT\UG_CFT\UG_CFT.h>
#include <uf_modl.h>
/* The following definition defines the number of callback entries */
/* in the callback structure: */
/* UF_STYLER_callback_info_t CHANGE_cbs */
#define CHANGE_CB_COUNT ( 7 + 1 ) /* Add 1 for the terminator */
#ifdef DISPLAY_FROM_CALLBACK
extern int <enter the name of your function> ( int *response )
{
int error_code = 0;
if ( ( error_code = UF_initialize() ) != 0 )
return (0) ;
if ( ( error_code = UF_STYLER_create_dialog ( "UG_CFT.dlg",
CHANGE_cbs, /* Callbacks from dialog */
CHANGE_CB_COUNT, /* number of callbacks*/
NULL, /* This is your client data */
response ) ) != 0 )
{
char fail_message[133];
/* Get the user function fail message based on the fail code.*/
UF_get_fail_message(error_code, fail_message);
UF_UI_set_status (fail_message);
printf ( "%s\n", fail_message );
}
#ifdef DISPLAY_FROM_USER_EXIT
extern void <enter a valid user exit here> (char *param, int *retcode, int rlen)
{
int response = 0;
int error_code = 0;
if ( ( UF_initialize() ) != 0 )
return;
if ( ( error_code = UF_STYLER_create_dialog ( "UG_CFT.dlg",
CHANGE_cbs, /* Callbacks from dialog */
CHANGE_CB_COUNT, /* number of callbacks*/
NULL, /* This is your client data */
&response ) ) != 0 )
{
char fail_message[133];
/* Get the user function fail message based on the fail code.*/
UF_get_fail_message(error_code, fail_message);
UF_UI_set_status (fail_message);
printf ( "%s\n", fail_message );
}
UF_terminate();
return;
}
extern int ufusr_ask_unload (void)
{
/* unload immediately after application exits*/
return ( UF_UNLOAD_IMMEDIATELY );
/*via the unload selection dialog... */
/*return ( UF_UNLOAD_SEL_DIALOG ); */
/*when UG terminates... */
/*return ( UF_UNLOAD_UG_TERMINATE ); */
}
int CHANGE_apply_cb_gz ( 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 ----- */
UF_terminate ();
/* Callback acknowledged, do not terminate dialog */
return (UF_UI_CB_CONTINUE_DIALOG);
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */
/* for this callback type. You must continue dialog construction.*/
}
int CHANGE_apply_cb_hh ( 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 ----- */
UF_terminate ();
/* Callback acknowledged, do not terminate dialog. */
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */
/* for this callback type. You must continue dialog destruction*/
return (UF_UI_CB_CONTINUE_DIALOG);
}
int CHANGE_apply_cb_ok ( 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 corner_pt[3]={10,10,10}; //定位点
char * edge_len[3]={"10","20","30"}; //大小
tag_t blk_tag;
UF_MODL_create_block1(UF_NULLSIGN,corner_pt,
edge_len,&blk_tag); //调用API创建方体
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);
}
int CHANGE_apply_cb_qx ( 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 ----- */
UF_terminate ();
/* Callback acknowledged, terminate dialog */
/* It is STRONGLY recommended that you exit your */
/* callback with UF_UI_CB_EXIT_DIALOG in a cancel call */
/* back rather than UF_UI_CB_CONTINUE_DIALOG. */
return ( UF_UI_CB_EXIT_DIALOG );
}
int CHANGE_apply_cb_x ( 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 ----- */
UF_terminate ();
/* Callback acknowledged, do not terminate dialog */
return (UF_UI_CB_CONTINUE_DIALOG);
int CHANGE_apply_cb_y ( 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 ----- */
UF_terminate ();
/* Callback acknowledged, do not terminate dialog */
return (UF_UI_CB_CONTINUE_DIALOG);
int CHANGE_apply_cb_z ( 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 ----- */
UF_terminate ();
/* Callback acknowledged, do not terminate dialog */
return (UF_UI_CB_CONTINUE_DIALOG);