|
int ROLL_constructor ( int dialog_id,/ f+ S8 t8 Q, @& G$ c
void * client_data," ]) p/ `: V/ s' W9 J+ k7 r9 G
UF_STYLER_item_value_type_p_t callback_data)& @, f' V% M: g ?( y9 z
{
2 f: A q9 \% w$ K N% V /* Make sure User Function is available. */ b5 `! s0 u- Q4 v4 Z: ^' x ?
char dir[100];
F5 w3 h+ U$ m const char env[155]="ugII_USER_DIR";" D, z6 _" x' I
char *basedir=NULL;+ L8 ~) F# F- P5 }& p* B
tag_t part;- p/ J7 ?) d) J% h5 a5 ~! I
UF_PART_load_status_t error_status;
9 T3 U/ l# p9 W' r& e0 ? v0 U# g basedir=getenv(env);
0 z% O' P4 w8 M" I; L
7 i2 c) i) ^1 a3 d strcpy(dir,basedir);) P9 O/ k% f- j- S# \& _
strcat(dir,"\\roll\\J-J 2D.prt");$ m4 e# G0 N" G$ J3 Y, i
if(UF_PART_open(dir,&part,&error_status)!=0)) r" s* u* x% }+ _& [9 C. m0 u
{8 N9 m3 h5 @9 q0 R( Y1 F' p0 u' E
UF_free_string_array(error_status.n_parts,error_status.file_names);7 [8 r3 U; B: C2 O) ]
UF_free(error_status.statuses);
- g2 Z6 U' q( t4 L( ?1 w return(UF_UI_CB_CONTINUE_DIALOG);" O5 f/ G! r) V. H4 Q
}
6 K+ q9 M7 } b4 i( g UF_free_string_array(error_status.n_parts,error_status.file_names);" U, f7 |2 a8 c/ { M
UF_free(error_status.statuses);4 q, ]. _% B( w3 w* M8 `- c u# J
double arExpValue[2];) d* W; O/ M3 O5 P/ Q1 J+ s
UF_MODL_eval_exp("threeJ_a",&arExpValue[0]);
- m, U- {+ F! R; l: n# k/ n- W' @ UF_MODL_eval_exp("threeJ_b",&arExpValue[1]);: o+ p- H, M) G* }' S
; d; v% r' q7 W5 g8 [3 o
UF_STYLER_item_value_type_t data_set;( u( J- m; |6 {% G4 r
data_set.item_attr=UF_STYLER_VALUE;! C# s! E, x3 h; z0 r) f, g
data_set.item_id=ROLL_A; (此处报错) " Y2 x! N, b1 `# I/ T) G! P
data_set.value.real=arExpValue[0];8 w; N i( ?; Y" Z y
UF_STYLER_set_value(dialog_id,&data_set);/ T: I- }/ Q% e) i% W
UF_STYLER_free_value(&data_set);
. l7 t) E/ [: d% J data_set.item_attr=UF_STYLER_VALUE;
! s6 y8 v6 k* t" S2 Z1 O5 } data_set.item_id=ROLL_B; (此处报错)
" v9 |6 R9 h3 T/ u8 o1 k: B data_set.value.real=arExpValue[1];# h0 W* _1 k: D' |$ J! Q0 m/ m
UF_STYLER_set_value(dialog_id,&data_set);
2 U, k; l( ?8 S3 n* n6 ^ UF_STYLER_free_value(&data_set);
# w2 z9 t# K& |0 l y UF_terminate ();$ Z$ _ B0 x; l. @( K+ e* F! ^
/* Callback acknowledged, do not terminate dialog */
+ x; L1 a- G6 T5 C3 k return (UF_UI_CB_CONTINUE_DIALOG);
( A6 V! K9 O) F /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */
7 r0 j; W, }( C" V( M* D% S /* for this callback type. You must continue dialog construction.*/
* H3 W6 E! k0 {& D. Z' k}
9 N* a) [8 S/ @8 Q. l0 f$ O* S0 B0 b8 a$ O6 V9 p
8 d" J1 A" f. m7 m, ? ~报错如下:
! \9 |9 J+ H* y3 Z* q9 H) H! yE:\roll\roll\threeJ.cpp(438) : error C2065: 'ROLL_A' : undeclared identifier
' g; s% A( s; y% ^8 ~. B# NE:\roll\roll\threeJ.cpp(438) : error C2440: '=' : cannot convert from 'int' to 'const char *'- c. x. g* o, l9 `. H& A
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
5 F# P8 z& e9 q8 EE:\roll\roll\threeJ.cpp(444) : error C2065: 'ROLL_B' : undeclared identifier0 E8 z4 V- q( D2 |( _
E:\roll\roll\threeJ.cpp(444) : error C2440: '=' : cannot convert from 'int' to 'const char *'0 p+ ~( i& m4 w" {1 W3 |( s9 N; x$ R
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
+ r; ~4 |9 }3 Y* j2 v6 V8 A' W! r其中 ROLL 是文件夹名称
' x, l# [ j4 Y7 Y/ P5 A& ^J-J 2D.prt 是部件名
. Y0 L- S+ l) LthreeJ_a1 H! A; {1 q+ x( L, N9 @& g
threeJ_b
0 ~, c1 C" Q$ ~" i% m+ f5 C2 u6 X0 ?是表达式的两个名称2 G: E2 T: q3 K* I6 P' U
' j; u+ z: O( p! }/ x, J1 [5 F# lROLL_A
a! T0 X+ R7 w; v! M6 F6 ^ROLL_B, R V& ^$ ~4 B8 H$ |
A和B是UISTYLE的标识符
9 f1 y4 s3 O6 }, K# W3 ^% t8 ^
9 ^$ M# e8 d; v请教,我这是一个初级的二次开发表达式,我只要定义两个参数化变量,请问我这里的constructor哪里出错?+ a; Y0 X# F+ j6 r; Q7 z/ v- |
我这也是参考一个例子编的,它的是五个变量。。, P5 F |) m% q3 m+ Y9 J
4 k- _2 |, F$ A1 Y1 H- G请各位高手能帮我解决这个问题,感激不尽! |
|