|
int ROLL_constructor ( int dialog_id,
z8 O; [1 Q, b' }3 d void * client_data,- T+ ~9 P+ V: i0 |" c0 O
UF_STYLER_item_value_type_p_t callback_data)
# ^; |( E/ D" c& f; Z# j. }{% g8 A$ @$ U0 i' L' K$ G, D8 L
/* Make sure User Function is available. */ 7 i4 A x. O$ K% b3 S2 u
char dir[100];
) H; I7 G# m D5 t6 Y4 K const char env[155]="ugII_USER_DIR";
: H$ N4 J" T; Z6 j! ^/ V8 P char *basedir=NULL;. b1 p# S- a0 l, y' @6 A
tag_t part;
" O8 L' e* u6 u% b% ` UF_PART_load_status_t error_status;
( i# X; F0 X$ K4 K; V- ]$ ` basedir=getenv(env);( U7 q7 h! K. P6 Y
* u9 D/ V/ H7 z
strcpy(dir,basedir);
( T$ u! A! P3 R7 [; @ O. | strcat(dir,"\\roll\\J-J 2D.prt");
& T$ h% \) a' V% e3 X% n- S' E if(UF_PART_open(dir,&part,&error_status)!=0)
" y. @" g/ r; v {
1 X; Q5 J4 u( ^3 t7 x UF_free_string_array(error_status.n_parts,error_status.file_names);6 A& o7 V; Q, v3 A9 {
UF_free(error_status.statuses);: j) F, J g3 y, O* N( O
return(UF_UI_CB_CONTINUE_DIALOG);# S# H! I9 u9 K. R$ o
}
/ I% y: U/ }4 `. Z) L UF_free_string_array(error_status.n_parts,error_status.file_names);
6 A H- T }! p% o8 b. ? UF_free(error_status.statuses);
2 S+ p; R7 e- V7 ] b* e0 V9 m2 F1 I" A4 k double arExpValue[2];
' m2 h" |/ p' @* F4 l' B UF_MODL_eval_exp("threeJ_a",&arExpValue[0]);! V( @& X& f' b+ o$ E
UF_MODL_eval_exp("threeJ_b",&arExpValue[1]);
7 ?( F8 c$ i+ P- i( Q1 `
8 j+ J; i: d3 `) e, y D9 h# f/ ^' J UF_STYLER_item_value_type_t data_set;6 a( ^2 Q( X2 Y$ ^
data_set.item_attr=UF_STYLER_VALUE;8 p3 @% C: l2 F
data_set.item_id=ROLL_A; (此处报错) 4 ]; h; f) l* `
data_set.value.real=arExpValue[0];
5 `9 s6 ]8 U* R UF_STYLER_set_value(dialog_id,&data_set);+ U8 Q, ?3 A5 P7 x# U& R2 K2 s
UF_STYLER_free_value(&data_set);3 A! |$ t9 n1 ?/ \/ z
data_set.item_attr=UF_STYLER_VALUE;
3 p% L) f+ A) i6 P* L data_set.item_id=ROLL_B; (此处报错)
5 m& a4 L6 `7 K) B( h. B* m2 W data_set.value.real=arExpValue[1];# C6 a6 o) K4 s
UF_STYLER_set_value(dialog_id,&data_set);5 C8 ^5 `+ d& a' Q5 _+ a7 ^
UF_STYLER_free_value(&data_set);3 _ M& X# Z2 |5 T# F
UF_terminate ();
A' X5 @$ i! \, M /* Callback acknowledged, do not terminate dialog */
# t/ r r# U$ |& U" } return (UF_UI_CB_CONTINUE_DIALOG);
2 t2 U3 k5 k9 s+ S /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */& U* \! ]$ N/ b$ w6 [9 i
/* for this callback type. You must continue dialog construction.*/
6 ?- D9 _& l3 L) R# s}6 }9 y0 v0 v2 Z% P0 O2 L
$ E5 L' q) `, F; f& [: B6 M
' o' y0 {. w! X1 W
报错如下:
" p t) Z% D6 D3 XE:\roll\roll\threeJ.cpp(438) : error C2065: 'ROLL_A' : undeclared identifier
7 b0 J) F! M* ], F( bE:\roll\roll\threeJ.cpp(438) : error C2440: '=' : cannot convert from 'int' to 'const char *'
- d3 n$ W! d4 n3 r: v7 G Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
$ `6 Y, M2 R" Z0 o; W7 U6 d4 zE:\roll\roll\threeJ.cpp(444) : error C2065: 'ROLL_B' : undeclared identifier4 I. ?. W' j3 n) e
E:\roll\roll\threeJ.cpp(444) : error C2440: '=' : cannot convert from 'int' to 'const char *'
* z, A: I- D% B8 N6 \ Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
5 \; a- G% D( @4 D5 t其中 ROLL 是文件夹名称
' C& G' L, G9 H3 ~# n& w- zJ-J 2D.prt 是部件名6 }% B2 ^& m. ^8 Y, y* T
threeJ_a, |2 \! u5 u4 m* ?( f: ]5 Z
threeJ_b+ E( O6 ~( g# c# Y
是表达式的两个名称
5 y' t" Z/ c0 ~$ m4 [/ O O; c! {. H4 R
ROLL_A
, _3 K4 K) O) C, KROLL_B1 x% {+ {9 { s+ w% `
A和B是UISTYLE的标识符2 Z# m* W; N0 b( u7 ~) s
& _0 X/ q4 G+ Z) b
请教,我这是一个初级的二次开发表达式,我只要定义两个参数化变量,请问我这里的constructor哪里出错?
1 \5 } k4 O" L( P我这也是参考一个例子编的,它的是五个变量。。" n3 Y8 I N- V: T$ W* F* p
" E/ t* o1 x' N: j& N4 s) E
请各位高手能帮我解决这个问题,感激不尽! |
|