|
int ROLL_constructor ( int dialog_id,
6 H" i% ?% I3 T% z: P: f void * client_data,* P: U. A* ^0 a; H' Q8 ?4 i; t
UF_STYLER_item_value_type_p_t callback_data)
; `, u/ A2 z5 B4 Y, @1 C& ~% q{
3 K# g8 D @3 d6 I, p& Q0 l2 N /* Make sure User Function is available. */
/ g' `/ N4 I! M6 P' P0 |' V char dir[100]; 9 p( J7 m) E) Y
const char env[155]="ugII_USER_DIR";
' `# R9 r4 P3 {, i" `3 L4 E H) N; ^; D char *basedir=NULL;
7 z$ A8 ?' v, }: W' h$ k! y tag_t part;
) v5 s! o i1 I9 ?7 ] UF_PART_load_status_t error_status;
8 I/ j+ }& u9 H' i |# f basedir=getenv(env);3 v6 a0 c% }9 B" B Y6 F% Y
. b6 J1 @( b7 x/ O4 ]
strcpy(dir,basedir);
6 O/ k7 E. _' h# v/ J3 L strcat(dir,"\\roll\\J-J 2D.prt");
# Z& l, D$ B5 H: p/ l if(UF_PART_open(dir,&part,&error_status)!=0)
7 M. ?; G" \) e' u* F2 @3 p {+ }. J9 P" {1 P# b$ S
UF_free_string_array(error_status.n_parts,error_status.file_names);4 v, q- B8 {- }! q2 p
UF_free(error_status.statuses);* p' `1 ~; M! X, j D6 o
return(UF_UI_CB_CONTINUE_DIALOG);2 s; M' V" U8 ?
}9 B- s3 S- P% ^" x! Y- L
UF_free_string_array(error_status.n_parts,error_status.file_names);
, k+ Y( q) e3 ]$ M UF_free(error_status.statuses);
8 h5 N2 x; Q; Z- G% @# B$ ]7 F: j/ T double arExpValue[2]; [2 k) E2 D1 A* l a2 P d
UF_MODL_eval_exp("threeJ_a",&arExpValue[0]);& v7 M/ L" V2 k
UF_MODL_eval_exp("threeJ_b",&arExpValue[1]);
9 x2 C. W3 e- x8 `
. [# D+ \6 E0 H X" g" q, Y* c UF_STYLER_item_value_type_t data_set;+ j- h6 E, q8 M4 h# i. m0 r
data_set.item_attr=UF_STYLER_VALUE;% B6 W5 v2 B" O! x, V# y/ D8 W
data_set.item_id=ROLL_A; (此处报错)
* T* V2 ]9 R) [% C4 J3 N9 F data_set.value.real=arExpValue[0];5 P3 D- j) q: c- S
UF_STYLER_set_value(dialog_id,&data_set);
1 I1 A( |2 F5 t' w: A" q UF_STYLER_free_value(&data_set);
( r! J L" H; W; E data_set.item_attr=UF_STYLER_VALUE;
5 G$ b0 Q# I9 h+ ?/ |0 ^) a# S data_set.item_id=ROLL_B; (此处报错) / @! ?. U' q) F- A: d% ]
data_set.value.real=arExpValue[1];
4 n2 I1 ?. B5 J: W* a$ G UF_STYLER_set_value(dialog_id,&data_set);5 ]& v( Q @( V2 i* w2 `9 q
UF_STYLER_free_value(&data_set);
9 K* Z- }+ D( N( ~- ` Y UF_terminate ();
2 O7 i2 v6 U; E' k( z /* Callback acknowledged, do not terminate dialog */
! ?2 z# E1 A0 v2 R# k return (UF_UI_CB_CONTINUE_DIALOG); 0 n2 B6 n8 z9 ^2 \/ P1 \
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */ e* O! s) w6 Z" a- |/ s
/* for this callback type. You must continue dialog construction.*/
2 D+ d5 V; f9 H# o' I: }# N}
# E7 p% L& `1 w1 |- s
- g& Z7 B, s" Z8 k# [* G- w9 w5 g: c; b7 L$ R- p5 u
报错如下:: S& |( e4 o$ o0 R* m0 C. }& ]( y
E:\roll\roll\threeJ.cpp(438) : error C2065: 'ROLL_A' : undeclared identifier
) V& q$ V( ?3 }E:\roll\roll\threeJ.cpp(438) : error C2440: '=' : cannot convert from 'int' to 'const char *' s. M" G" W% ~% b4 E# ]
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
( i& O; t6 \) a& ^0 b5 eE:\roll\roll\threeJ.cpp(444) : error C2065: 'ROLL_B' : undeclared identifier
0 G% f. Q" Z+ d* `- S1 _E:\roll\roll\threeJ.cpp(444) : error C2440: '=' : cannot convert from 'int' to 'const char *'1 Y: ]8 G5 {" n) d& m+ S( z
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
( ~ W: }+ ?6 d- ^, C: }( J& u% T其中 ROLL 是文件夹名称
+ K& e+ K, }" L# C6 x% IJ-J 2D.prt 是部件名
1 b6 E7 q0 ~. A5 a) a& VthreeJ_a
; |3 N6 y4 ^. X& ithreeJ_b( v1 B- _$ I/ A
是表达式的两个名称
7 J1 Z7 n3 J& o$ u. U- a3 ~
) I" }0 g- e7 c" o! r: rROLL_A
9 q+ X/ p5 b; [- Q) IROLL_B
, d' u! z c4 ^. M' {& v3 zA和B是UISTYLE的标识符# d, e6 }4 P) s, Y2 Z
/ `, p& a9 [- f7 {, C( A) a请教,我这是一个初级的二次开发表达式,我只要定义两个参数化变量,请问我这里的constructor哪里出错?" M8 S6 K8 k% F. f5 _/ }
我这也是参考一个例子编的,它的是五个变量。。
4 Q6 c* Z' H$ T \( N. w( e! z8 q1 u0 C
请各位高手能帮我解决这个问题,感激不尽! |
|