|
如下是我给我用UISTYLER开发的界面中ok键写的代码。6 z0 [. w o1 r$ a4 }6 A' r8 l
' C* b) b* [+ o% n5 _
我的目的是通过触发ok键来将界面中已经填写的属性值创建到part中去。! W* f- c" \7 o& J
( i' [: l, u2 T# h$ o: q5 U
一共是12个需要添加的属性以及属性值,请高手看一下,我这段代码编译无错误但是2 Y/ f3 i. h9 P$ Q( y- F
放到ug中使用缺一点效用都没有。; ^* v& Q' w; H1 J. ^
9 s" _8 L7 p8 c) e不胜感激i2 M- X2 @4 M# C) h* y
}0 [# |, b' P7 i2 g ?3 `3 Tnt CHANGE_ok_cb ( int dialog_id,
3 e5 y6 {' K1 ~0 n2 @ void * client_data,6 I+ `6 ^: B! W F* R
UF_STYLER_item_value_type_p_t callback_data)' b% Q5 M5 l: @- {# L. r; s
{# h7 P. ] H$ u# y& [
tag_t object;
3 {5 e+ c1 v ?! s% q int curr_part;
% F, V- c% |! s# m: z extern int UF_PART_save(void);
! u0 J% e' A" t8 |2 C/ p! s9 R UF_STYLER_item_value_type_t data;
. d4 L, u7 K, w( q
; C; P0 N+ f0 c3 ]5 V string_value1.type=UF_ATTR_string;
0 c. e$ [ _: B1 x8 j- m) G5 i1 v string_value2.type=UF_ATTR_string;
6 t5 O4 w6 g2 B8 T string_value3.type=UF_ATTR_string;
, ^! i( ?+ y6 h% B) `) a string_value4.type=UF_ATTR_string;! G! R" J- K( T& M( u0 k
string_value5.type=UF_ATTR_string;
- h0 y$ Y! t! W5 z string_value6.type=UF_ATTR_string;
/ P. x. b: x, n L; E7 X { string_value7.type=UF_ATTR_string;6 U, q0 m, ^2 ?, U
string_value8.type=UF_ATTR_string;
. y7 M# Q: W5 C) z( [ string_value9.type=UF_ATTR_string;+ F6 p% y% Y9 X$ S( W. d: z
string_value10.type=UF_ATTR_string;
3 z) }6 r, C! C2 S0 B5 A8 L string_value11.type=UF_ATTR_string;
: c" F" c/ L& H# Y5 Y& N& r string_value12.type=UF_ATTR_string;
) q! A" p4 d- a8 Q% @7 B /* Make sure User Function is available. */
+ c& E. k- E& x. ^* B" Z: L9 B if ( UF_initialize() != 0) / M6 D. a4 ~& Y' g$ w
return ( UF_UI_CB_CONTINUE_DIALOG );6 P# @ B2 G. m+ o1 r( d
/* ---- Enter your callback code here ----- */. W3 l7 U; I- Q, k
, ^, g {4 j0 C9 S d$ L for(curr_part=0;curr_part<2;curr_part++)5 g" t4 \/ Y- k
{
; s0 K9 C; `1 R4 w6 F$ `9 w object=UF_PART_ask_nth_part(curr_part);7 S( f, m/ E$ W0 d; m" N; v
}
$ j t6 z4 J) K) O3 F data.item_attr=UF_STYLER_VALUE;; b) q* j1 x/ {
data.item_id=CHANGE_STR_PART_NUMBER;
; H4 @3 @+ a" Y# Q; N. ] UF_STYLER_ask_value(dialog_id,&data);
# L6 `& \: i6 P: g* h string_value1.value.string=data.value.string;
L% {- S( j" M; J UF_ATTR_assign(object,title1,string_value1);
' W$ ^' M4 X) Z* K+ }' } data.item_id=CHANGE_STR_PART_NAME;+ C' p% Q7 q9 |% O$ L2 i
UF_STYLER_ask_value(dialog_id,&data);; A1 v4 C# W. T; H
string_value2.value.string=data.value.string;; `9 T) R) k2 B- H/ I
UF_ATTR_assign(object,title2,string_value2);
5 Y: e# q7 g a" ?4 ~' J7 H5 W. L data.item_id=CHANGE_STR_MATERIAL;9 R' Q$ p- o1 N) n
UF_STYLER_ask_value(dialog_id,&data);
' Z+ C) k3 O$ z" Z string_value3.value.string=data.value.string;
9 x0 x6 L; ^. I UF_ATTR_assign(object,title3,string_value3);/ u/ u- O" ^; n9 l9 r# {
data.item_id=CHANGE_STR_HEAT_TREATMENT;
! w: |, y9 w( G; {. `' ^& F UF_STYLER_ask_value(dialog_id,&data);/ F6 x! _8 y0 Q( G
string_value4.value.string=data.value.string;7 w. D+ ~8 E- j W: z; g
UF_ATTR_assign(object,title4,string_value4);
9 S3 m! |+ t) V M9 W' L data.item_id=CHANGE_STR_NET_WEIGHT;
" ^( }; L" @) h* ~, l UF_STYLER_ask_value(dialog_id,&data);1 C. ^! O1 n( e% k6 E
string_value5.value.string=data.value.string;/ x2 I7 e5 ~4 W" w0 I5 N
UF_ATTR_assign(object,title5,string_value5);6 N: i7 d# i, f( O
data.item_id=CHANGE_STR_PART_VERSION;! i2 U9 w" S2 {7 M% A2 C$ K( d
UF_STYLER_ask_value(dialog_id,&data);
x) }8 j# v$ V/ G string_value6.value.string=data.value.string;4 D1 y5 \" u- [* ?+ Z8 U
UF_ATTR_assign(object,title6,string_value6);
/ n2 Y G) n t$ Z data.item_id=CHANGE_OPTION_DRAW_SIZE;
1 n/ p( ~+ G2 Y8 u2 L UF_STYLER_ask_value(dialog_id,&data);
6 U L' l' G, d, v' `- | string_value7.value.string=data.value.string;
7 j, p: W8 x9 ^5 S+ w UF_ATTR_assign(object,title7,string_value7);8 u" E I! B2 ]+ v& H
data.item_id=CHANGE_OPTION_DIMENSION;' d( l' h; o5 d+ r" U, X# G! M- a
UF_STYLER_ask_value(dialog_id,&data);) `" v, ]4 C; y- b
string_value8.value.string=data.value.string;! p5 ?* \* U# l
UF_ATTR_assign(object,title8,string_value8);; t" H9 @/ M8 d6 g
data.item_id=CHANGE_OPTION_BOM_LIST;
- G: |3 K9 F# Q) b# l UF_STYLER_ask_value(dialog_id,&data);
* P5 }( Q" P5 Z6 |# {! G8 L0 {0 |8 H string_value9.value.string=data.value.string;
' ~; B0 a: m6 M3 F UF_ATTR_assign(object,title8,string_value9);# ?" D7 L( `4 h% w7 b
data.item_id=CHANGE_STR_DRAW_PAGE;
; X! W N) f9 f4 T/ |2 O UF_STYLER_ask_value(dialog_id,&data);- T5 ^; B# {4 o: X) d4 e1 l! y
string_value10.value.string=data.value.string;
0 U; q4 }# V$ c o6 Y% v* \ UF_ATTR_assign(object,title10,string_value10);: q1 W, j$ r l7 F2 v
data.item_id=CHANGE_STR_REF_DRAW;# k! c8 a+ E+ {- Q
UF_STYLER_ask_value(dialog_id,&data);
3 B% m, b; A& L3 U/ ?8 D- u string_value11.value.string=data.value.string;" u- {5 z, p) B% ?8 n' w5 G
UF_ATTR_assign(object,title11,string_value11);
* k; Z* Z# T1 L data.item_id=CHANGE_STR_NOTES;
/ {# v7 t) \. C. k% R UF_STYLER_ask_value(dialog_id,&data);0 r0 \- R: C! m6 ?6 z
string_value12.value.string=data.value.string;6 L; w3 H; I5 |: v' L
, O [9 f$ `% s+ i- m% f UF_ATTR_assign(object,title12,string_value12);9 M6 U; t& }# N" z
UF_PART_save();
) }+ G8 g/ u0 {/ g" _1 d: E% O
& A! Q. e# V& W& V: g% r% C UF_terminate ();3 y ]. D4 d, ?3 {
/* Callback acknowledged, terminate dialog */7 n& { u) {$ x0 P, O, H+ k' s
/* It is STRONGLY recommended that you exit your */
! ?3 n. c. w8 } /* callback with UF_UI_CB_EXIT_DIALOG in a ok callback.*/
! |) C" `5 ~# v5 j/ l /* return ( UF_UI_CB_EXIT_DIALOG ); */7 z" I- D5 B P" C. d2 J
return (UF_UI_CB_EXIT_DIALOG); ! o% ]2 X+ P, Z, V. g
} |
|