|
int ROLL_constructor ( int dialog_id,; l2 y% ^: g5 E+ T
void * client_data,, P7 Y, }2 ^: B- Y" g3 h
UF_STYLER_item_value_type_p_t callback_data)
6 D8 F' s7 {. ^& \1 K! T5 R3 E{
/ f8 L; O. @$ G3 N& B) R9 x /* Make sure User Function is available. */ 7 e' X" ?) [, G" X5 X0 {
char dir[100]; 3 C- k7 q% i7 x0 k o# n! n3 j
const char env[155]="ugII_USER_DIR";/ |( q/ F, q8 a6 K+ h2 X( Y" D
char *basedir=NULL;
/ K& o. Y* c6 U tag_t part;
& d$ n& N) y; [8 b5 Q UF_PART_load_status_t error_status;1 c6 l5 G3 K2 Q7 x' N* p5 n
basedir=getenv(env);, \% E k5 ?$ I1 W
, \& W& I: M+ h# s; I! b6 t9 [
strcpy(dir,basedir);" u+ K, X" P' ]9 N4 z' k
strcat(dir,"\\roll\\J-J 2D.prt");
; r# ^/ `- d# O4 ?% g if(UF_PART_open(dir,&part,&error_status)!=0)) S _ i5 C7 W/ g: p' G
{
- n4 h) v/ o O7 \2 s; i0 |% D UF_free_string_array(error_status.n_parts,error_status.file_names);; |( h# m5 s: @& k% U# J; U
UF_free(error_status.statuses);! E* x6 z) q! X! x4 ^$ b/ t! L
return(UF_UI_CB_CONTINUE_DIALOG);
: j" a& N5 |) O+ e4 L5 E }9 V! v! A4 P+ ^5 _
UF_free_string_array(error_status.n_parts,error_status.file_names);" H) U3 r0 d1 q- D/ z, P! H; T
UF_free(error_status.statuses);( n! L# ^5 ~$ M) ]$ V3 w$ w) @" R% c
double arExpValue[2];
. `" ^6 ?% D7 H, ` UF_MODL_eval_exp("threeJ_a",&arExpValue[0]);) T# P& n! f" H" A- G) u0 L8 I
UF_MODL_eval_exp("threeJ_b",&arExpValue[1]);
5 {% w' J$ z# A, A4 n
1 T' x4 u, z8 v0 ^/ e UF_STYLER_item_value_type_t data_set;0 C' Q6 w1 U/ R) C. t% K7 Z
data_set.item_attr=UF_STYLER_VALUE;8 s u4 [$ o# R3 p
data_set.item_id=ROLL_A; (此处报错) / }& t' g. n: Q2 z: z
data_set.value.real=arExpValue[0];
. W. \4 x6 r0 i- A, A UF_STYLER_set_value(dialog_id,&data_set);
$ E6 j: g$ N, w' n2 ?' j5 [ UF_STYLER_free_value(&data_set);
* |$ I5 V, g3 A& u- t data_set.item_attr=UF_STYLER_VALUE;
# `8 y3 n( N0 } \: H6 I! b data_set.item_id=ROLL_B; (此处报错) : ^7 M8 ~; m# M: U+ ^$ ], w2 z
data_set.value.real=arExpValue[1];
% M9 F* W$ Q8 q8 F# \6 k UF_STYLER_set_value(dialog_id,&data_set);/ h/ W+ m7 c- P* N
UF_STYLER_free_value(&data_set);: u, m; ^) L, _
UF_terminate ();' }5 w8 \# {6 C3 H% R/ O( }
/* Callback acknowledged, do not terminate dialog */& {6 D# _4 p5 J" S, j- z
return (UF_UI_CB_CONTINUE_DIALOG); * h! U/ v8 R, j' m# h
/* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */
4 L; I" l1 _ [8 z9 z8 O /* for this callback type. You must continue dialog construction.*/
) x. Y6 h3 Y6 u2 f# o9 g- D}, D& P1 C2 h6 q
/ a5 q7 Q# U6 o$ ?9 S5 W; K
, I3 X' @3 {3 ]: v
报错如下:
: y5 y z" t8 t; [# T8 v" e8 nE:\roll\roll\threeJ.cpp(438) : error C2065: 'ROLL_A' : undeclared identifier
' s/ {9 w' I# X* e rE:\roll\roll\threeJ.cpp(438) : error C2440: '=' : cannot convert from 'int' to 'const char *'' L9 A/ Z/ U" E' y' Y' ?& H
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast" D8 j; p3 e3 F% R Q
E:\roll\roll\threeJ.cpp(444) : error C2065: 'ROLL_B' : undeclared identifier3 M1 k! W! s- J1 B4 x! z4 r% F) g
E:\roll\roll\threeJ.cpp(444) : error C2440: '=' : cannot convert from 'int' to 'const char *'3 [# o- t: F) x3 }+ r8 ^7 |2 }6 [: |
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
% \! U0 N, l$ I& y4 @. S其中 ROLL 是文件夹名称
. T/ _8 d1 Y9 D; W. E/ T- ?J-J 2D.prt 是部件名/ z- \: r& w: i& \1 j
threeJ_a/ U9 Z9 _5 w8 j6 p+ M* J
threeJ_b
+ _& P; U3 V/ s- @是表达式的两个名称$ v4 t5 e6 d- X+ |
/ N3 k$ k8 A1 O
ROLL_A
( Q) _8 S# H6 bROLL_B: @8 I d0 h, [" ]4 E8 [
A和B是UISTYLE的标识符5 y |7 {; X& W: ?8 B
0 n! l+ Z" x% A请教,我这是一个初级的二次开发表达式,我只要定义两个参数化变量,请问我这里的constructor哪里出错?
. t& J. ^! y/ f+ ]& I2 S, |/ j1 M我这也是参考一个例子编的,它的是五个变量。。- B T. I# G! o5 `$ X% v
5 O* K+ X* k. U# t6 e' V, n请各位高手能帮我解决这个问题,感激不尽! |
|