|
|
蝎子
发表于 2014-3-13 17:50:01
|阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
#include <stdio.h>) c. v/ h* f+ W# c
#include <uf.h>; V) v8 o& d9 \$ H" E2 b
#include <uf_ui.h>
$ h1 Y% J8 ^. E$ C# A) t# t _* N7 u#include "UG_UI.h"
+ @3 P$ W9 w0 B7 K* f, O#include <uf_mb.h>' K1 p; T2 `- p4 e/ Y. y* ]
#include "UG_UI_calculate_dialog.h"; @7 t8 I7 j' U/ l$ H$ }
4 K: I0 h' o9 T/ [6 @9 O/ j3 v$ D/*****************************************************************************7 O8 ]$ [& k! x0 X9 D
** Activation Methods/ E; E) _! N V1 {, }: T
*****************************************************************************/
6 x. g8 Q- v- Y: V* Y( }1 D4 y M5 L/ P' _7 n5 x/ F- m+ F( _
/* Unigraphics Startup5 G, N8 I$ l. s8 Q8 E, h
** This entry point activates the application at Unigraphics startup */5 x: s5 q+ J6 l/ c8 V
extern DllExport void ufsta( char *param, int *returnCode, int rlen )# h C, K- X: e V
{
- H* U7 I9 w2 t; z /* Initialize the API environment */
3 T$ }% S: N3 E static UF_MB_cb_status_t UG_UI_Test_Dialog_fun( UF_MB_widget_t,
2 l- |3 P# ?7 A' a, P6 g UF_MB_data_t,UF_MB_activated_button_p_t );- \) c! q1 @+ I; V8 j& E
static UF_MB_action_t actionTable[]=
& f9 L- b7 m* E* [& \ {$ E9 B$ o& ? K& Z
{"UG_UI_ACTION",UG_UI_Test_Dialog_fun,NULL},) T! D. q( ?! z# k/ O" K
{NULL,NULL,NULL}
' b3 c. x$ Y) l+ W+ D };
/ V5 m- K/ H( x& ]$ o3 Q int errorCode = UF_initialize();
. n, A; |# \& m# [+ w! x# _ if ( 0 == errorCode )
( S) o" Q- a5 E) y5 | {
) x: U5 M0 e9 m9 l, z UF_MB_add_actions(actionTable);+ J- |, _1 p4 e
errorCode = UF_terminate();1 k- H& q# u/ E, I
}
! R* |( v. ~. ~9 n PrintErrorMessage( errorCode );1 j* q- r! z4 L, Z$ Y" O
}
* ?1 p( E" l6 u6 W6 z, x- \( w% w/ Q' L$ M; q
static UF_MB_cb_status_t UG_UI_Test_Dialog_fun($ k$ _, n. |* F3 K5 @7 P. T$ s
UF_MB_widget_t widget,9 [4 k. W& j) K$ S4 _ U2 K A
UF_MB_data_t client_data,
% B+ v- ]# A- f$ Z" Z- I UF_MB_activated_button_p_t call_button( P A: ?" P7 z. f9 t
)7 S" x$ v; \1 A4 B, ]( W* M
{. l* S3 L" E: ?( P7 q, @1 r
UG_UI_calculate_data m_data;$ W+ k& |' @9 z, q
int response;$ @6 ^, c5 r) }# e1 b2 G3 L$ d8 t7 e
LaunchCalculateDialog( &response ,&m_data);
0 n: ?4 V$ Q# w0 I return UF_MB_CB_CONTINUE ;! V" H5 z( f6 B* l9 u/ D
}
- N5 u# m# n* y0 o8 a+ N/ ^/***************************************************************************** }. N! \# Y6 Q" Z5 Q( b
** Utilities
% X" E3 [4 ?3 s, M1 s3 |' X: a*****************************************************************************/
1 {+ I* s s, p& @) G. |9 z3 i2 l- w: X8 G
/* Unload Handler! t; c7 g1 Q: K) @
** This function specifies when to unload your application from Unigraphics.7 q( R5 c# _" } b1 K
** If your application registers a callback (from a MenuScript item or a9 H6 D# m4 _! Y! t1 f c
** User Defined Object for example), this function MUST return
4 ^* t- a" A4 S6 P9 E** "UF_UNLOAD_UG_TERMINATE". */
1 [" n* c: P3 _) \extern int ufusr_ask_unload( void )
! I: ^2 o& A4 g# P9 C F4 |) _& O$ \{4 `! m) o9 \+ x4 l3 M
return( UF_UNLOAD_IMMEDIATELY );& V& `: U$ A6 `( y. v" O: E" ]: K
}
( T/ X# L, Y$ o# P( I# T
/ E+ N+ G- w9 j4 d3 u" _; i1 a- i/* PrintErrorMessage
( l, n+ r2 }( n& L% b$ d**- T& x- G6 R( x1 @5 f% z
** Prints error messages to standard error and the Unigraphics status
+ j' N9 x! V. S** line. */7 o# @0 ?0 \8 Q! |/ m' H p+ S$ G+ g
static void PrintErrorMessage( int errorCode )
# O6 ? d. y0 ]( }, N{
, c8 l. `! M) X, y# W if ( 0 != errorCode )
) p- p) U ?7 r$ b! t y2 d" e {- }" ?. c4 g1 z
/* Retrieve the associated error message */9 } H! m' G9 g$ u& b/ Z
char message[133];. `* |, `4 O8 M. X0 R
UF_get_fail_message( errorCode, message );
8 A$ E2 S0 D. I+ ~. Y" n: |- k! Q
* g( @# d) G* ^5 G& y /* Print out the message */; A) F4 ^& u i6 N3 K
UF_UI_set_status( message );8 J1 H( [- _% v1 g# z
6 F+ `- Z! H" b( T/ x1 C( p8 z
fprintf( stderr, "%s\n", message );
# C* E6 B9 [8 \: d+ S G }5 @' a0 i' `. y$ c$ I* j+ K
}; u$ A: J% w2 i# q0 ?4 @: @
以上代码编译之后显示# _3 c$ r2 A! e! F2 A$ ?& m, C. v
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(54) : warning C4013: 'LaunchCalculateDialog' undefined; assuming extern returning int' b( n$ Y8 k9 E3 w* b' }
d:\ugkf\lesson1\ug_ui\ug_ui\ug_ui.c(55) : error C2065: 'UF_MB_CB_CONTUNUE' : undeclared identifier
- s! E9 Y; O% ~1 j5 ~自己怎么都解决不了,不知道哪位大哥可以指点一下小弟: V5 d c3 ?) Q7 F$ o
6 D" M6 G9 J2 h
|
|