|
int ROLL_constructor ( int dialog_id,/ N2 r5 J% ]- G( Y9 b5 G
void * client_data,
, W& ~9 u p3 g, [* c& O( \2 c UF_STYLER_item_value_type_p_t callback_data)9 {& b$ _9 ~6 i
{" Q! _6 b0 ?: J& y8 ?+ `6 q
/* Make sure User Function is available. */ : } M- _# C/ d$ `
char dir[100];
$ i9 r+ L( Z. Y! }5 t7 `9 l const char env[155]="ugII_USER_DIR";
2 ~; A. I( |# } K) }& t char *basedir=NULL;
( ]/ m r, r# g: ]# V tag_t part;' b4 }: Q ^# n' }
UF_PART_load_status_t error_status;
1 v9 b& m$ e. m" U. k4 C5 f basedir=getenv(env);) W+ i" u6 \( \" H+ i
7 d% `( D: E2 c8 W, g strcpy(dir,basedir);
: _9 d8 y N6 O7 O strcat(dir,"\\roll\\J-J 2D.prt");
/ C# x6 J5 X/ X, N% | if(UF_PART_open(dir,&part,&error_status)!=0)
5 Z2 z7 h* Q8 B# K D Z/ p {2 o. B' e: ]1 Q, q' `
UF_free_string_array(error_status.n_parts,error_status.file_names);
, G6 B4 ?) Q, L5 ^4 y7 ]7 M( ?! o- {" e UF_free(error_status.statuses);
' w4 V+ o4 l7 c9 o6 l return(UF_UI_CB_CONTINUE_DIALOG);
, n0 {8 W) M' J( l }9 a: x, c) _( x$ V }2 K
UF_free_string_array(error_status.n_parts,error_status.file_names);1 u. W& i6 g/ N3 |& I
UF_free(error_status.statuses);0 [* N- a) M2 a9 y/ h
double arExpValue[2];2 s) i( a4 [; k
UF_MODL_eval_exp("threeJ_a",&arExpValue[0]);
( E" B# Z6 x R' W UF_MODL_eval_exp("threeJ_b",&arExpValue[1]);
; T$ N" k2 M C: V4 K9 k
8 V, P) D' Z# T9 |" u UF_STYLER_item_value_type_t data_set;+ Z, ?* V h. h/ ]6 @+ q6 C6 ?" I; f
data_set.item_attr=UF_STYLER_VALUE;1 m/ j0 H( L- v, Y$ B j
data_set.item_id=ROLL_A; (此处报错)
! f, V( I' [$ X* k& @/ b3 G data_set.value.real=arExpValue[0];* [) @' t; M4 H7 {$ f& m) q9 d; F
UF_STYLER_set_value(dialog_id,&data_set);
4 T$ B7 F: c" Q" { UF_STYLER_free_value(&data_set);9 u! m( O V; y! i* b
data_set.item_attr=UF_STYLER_VALUE;
: b2 N# @$ b0 o1 J: D data_set.item_id=ROLL_B; (此处报错) 0 T `2 V1 k' w
data_set.value.real=arExpValue[1];
; U& t2 R+ n" ]( M1 g% P1 H d UF_STYLER_set_value(dialog_id,&data_set);
# W1 S7 x) `- k# G UF_STYLER_free_value(&data_set);
4 G) G* n) H3 e' w. A$ x# p. Z UF_terminate ();
* F! N1 }$ l, c& X; o% I( @ /* Callback acknowledged, do not terminate dialog */
# I* N2 C- P6 p# s2 X return (UF_UI_CB_CONTINUE_DIALOG); 4 V5 Y# K r( V) e6 {+ |
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */5 d$ e5 X5 ]- |% z6 u) L+ b- E
/* for this callback type. You must continue dialog construction.*/
# X& b$ t/ r7 R: A5 f* a}2 D& D9 m+ F: l. _/ W; W, {( _
# d& I" ]) t+ G' p1 d5 h2 l( [) F! t. O' g/ p" Z6 f5 _* l
报错如下:" | z/ A i% B- C( M1 j0 X: f$ u
E:\roll\roll\threeJ.cpp(438) : error C2065: 'ROLL_A' : undeclared identifier" D6 x0 D' k# J/ M# u
E:\roll\roll\threeJ.cpp(438) : error C2440: '=' : cannot convert from 'int' to 'const char *'
$ o% b- J: l1 l" k4 {: n3 i* f6 c Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast" @; A$ z" ^% g, e( G# \
E:\roll\roll\threeJ.cpp(444) : error C2065: 'ROLL_B' : undeclared identifier
! x4 ~' I! f& L' g% D& l/ oE:\roll\roll\threeJ.cpp(444) : error C2440: '=' : cannot convert from 'int' to 'const char *'
: c* O2 y5 _- j! q) ^9 t Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
$ R2 q. r/ h/ x其中 ROLL 是文件夹名称
. p( I6 n6 U5 GJ-J 2D.prt 是部件名6 K( [, m% }4 F; Y& k
threeJ_a
% u3 F( R. a6 Z6 F5 d$ f, @threeJ_b
1 [, q, t) r! `" Y6 G* t是表达式的两个名称) i+ F& q' u! p3 F L3 v7 D/ ^
' M1 u7 l' y2 {
ROLL_A# w. x! D, R; p+ D
ROLL_B
/ O% x0 |' H9 f2 L7 ^" L) mA和B是UISTYLE的标识符3 y9 \4 M" S; h- t
" T: `! m% x8 j& O- h请教,我这是一个初级的二次开发表达式,我只要定义两个参数化变量,请问我这里的constructor哪里出错?4 ^4 G) i5 e2 j6 D; w
我这也是参考一个例子编的,它的是五个变量。。
4 N* s! o; R) M. m/ S3 u4 h" v+ v! k$ R# ^$ n( K
请各位高手能帮我解决这个问题,感激不尽! |
|