|
刚刚进行vc++与ug nx 7.0二次开发 在编对话框访问时生成dll 但是使用nx open后调用dll 然后出现“缺少需要的库内存 功能ufusr”. t1 A( B4 D6 a' I
亟待解决啊
% N9 B- Y/ T0 B! ^4 J附代码:
8 l) i5 b, ^8 E* r: @) P1 N/* These include files are needed for the following template code. */
; S5 ^3 S$ q% ?+ ] V2 X#include <stdio.h>
+ F" v0 o4 O k# `& q#include <uf.h>
f- h5 W+ ?7 e#include <uf_defs.h>
+ f7 K$ p: ?1 Z#include <uf_exit.h>, N6 c' g3 _) }4 ^: B# s+ ^
#include <uf_ui.h>
6 A) B7 m& {0 L! A- U#include <uf_styler.h>
, C' R" C/ \; B8 `2 w& i) J& v#include <uf_mb.h> 2 s- _$ p1 D+ z% E3 ~4 n4 M/ X
#include "access_dialog.h"( q# ]% R% e. M4 X/ S
& v* v8 w: M1 z/ r4 G7 |1 k/* The following definition defines the number of callback entries */
0 O) U# P. s7 }2 m/* in the callback structure: */
5 K5 k( K1 C' r3 J/ S# k/* UF_STYLER_callback_info_t DIALOG_ACCESS_cbs */
, I |( g/ u& x, C3 ?* _#define DIALOG_ACCESS_CB_COUNT ( 2 + 1 ) /* Add 1 for the terminator */; W! Z: _# x6 P R4 C; S# q" @# q
# _' g) g s I4 j4 V9 ?1 { [/*--------------------------------------------------------------------------% G0 w4 Q, k# Y3 l8 u$ S: L! A
The following structure defines the callback entries used by the $ W) S" J" K; o! ~( W
styler file. This structure MUST be passed into the user function, . y) F4 y1 F4 }3 }! \7 S, ]
UF_STYLER_create_dialog along with DIALOG_ACCESS_CB_COUNT. + f4 P9 v8 A, v
--------------------------------------------------------------------------*/
7 Q' b- i R3 |2 V) astatic UF_STYLER_callback_info_t DIALOG_ACCESS_cbs[DIALOG_ACCESS_CB_COUNT] = 9 u) D; g% i" ?7 i, p
{
' K& ^& h u( E7 I7 r, V {UF_STYLER_DIALOG_INDEX, UF_STYLER_BACK_CB , 0, DIALOG_ACCESS_back_cb},( a( w2 r4 y8 h/ G' x6 D- v
{DIALOG_ACCESS_BUTTON , UF_STYLER_ACTIVATE_CB , 0, DIALOG_ACCESS_button_cb},
! ^3 [# A, d4 d h2 s {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
( ?6 j! p6 q: [! ~0 L% t: a};
: m" @7 E7 d" B% R' i6 s" W
Q! d0 Z8 W* c* F8 v. ~# B \
0 k; Q+ l. T3 P% F- e$ \( o* l+ x5 |4 G1 Q0 r, [+ {
/*--------------------------------------------------------------------------
F U; u* f, y- @$ c+ H2 s* DUF_MB_styler_actions_t contains 4 fields. These are defined as follows:9 T% o, C m- c! j, V( r: P
7 A! ~) p- G1 D$ G0 e
Field 1 : the name of your dialog that you wish to display.
0 p( r* I6 G7 @7 A) }6 l0 y l. TField 2 : any client data you wish to pass to your callbacks.
) L, d* G7 l2 n/ \6 eField 3 : your callback structure.5 L5 t) r3 j9 ~* l# k+ m0 u
Field 4 : flag to inform menubar of your dialog location. This flag MUST ( ~" E: q. A3 m# {
match the resource set in your dialog! Do NOT ASSUME that changing ; p+ d- a, c" H, D0 U8 ]( }6 u% _' m
this field will update the location of your dialog. Please use the 6 m# K: V& G$ {
UIStyler to indicate the position of your dialog.( ~* T4 r0 j% ]$ q4 b. [2 B! O
--------------------------------------------------------------------------*/9 |: E9 T! U# ?: ?) r& q! {) o
static UF_MB_styler_actions_t actions[] = {. g, i# J3 z: \6 G7 r
{ "access_dialog.dlg", NULL, DIALOG_ACCESS_cbs, UF_MB_STYLER_IS_NOT_TOP },' ~! u& V2 @2 ^$ |, @3 n0 b: v
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */( }1 d% O0 b& z8 Q4 ~ z
};
' a) ^# w+ [2 p9 z
% ^- B( B, r, z4 L# N% S6 c/ p8 T* N& [1 }% j) k
5 r5 V4 u0 l% H+ \, G# L& j9 ~$ u0 `' B/ C5 i; V) {$ X, K! c/ l
/ D1 _% H6 m5 j& t2 o
1 Y U2 {* |# z- @3 `8 ?( f; t1 u
- {" G" h) M4 G; ^& H! c9 H B1 v, W4 B4 z- R
/*---------------- MENUBAR HOOKUP HELP Example -------------------7 Q1 s0 N1 h$ y- h9 E* m
To launch this dialog from a Unigraphics menubar, you must follow ) p' b: X& \9 C9 m% M# u1 d9 K: B
the steps below.' y4 Q1 Q. U2 L1 K
1) Add the following lines to your MenuScript file in order to
! M' l8 y' h/ q" B% n associate a menu bar button with your dialog. In this
6 f% R2 ]$ H* J1 x+ j) K) m example, a cascade menu will be created and will be
7 g# Z5 L0 I: p1 k* |' z located just before the Help button on the main menubar.
5 M+ z( N: Z l The button, ACCESS_DIALOG_BTN is set up to launch your dialog and $ x+ y; |1 `/ D/ u9 u; D- B: l
will be positioned as the first button on your pulldown menu.
# n7 B0 U+ W' K( ]: z5 v! U If you wish to add the button to an existing cascade, simply U& d4 T3 k# \+ {$ s3 s; ]6 I
add the 3 lines between MENU LAUNCH_CASCADE and END_OF_MENU
7 w" ]& q6 p$ k: F, W% ^6 s to your menuscript file.
3 l7 Y. r5 ~8 J: a* f- ~1 O& D. Y( o9 a( L) P
The MenuScript file requires an extension of ".men".
6 u4 }& Z1 i6 h( z2 k! H" p9 D Make sure that you add the extension to the file and place ! ], A5 B: b2 V9 G3 ]6 g& I
the file in your startup directory:
4 ]" q5 e* b( }& l7 B$ W $UGII_USER_DIR/startup or 7 R/ i% Z7 k4 S# e: H
$UGII_SITE_DIR/startup or $ b3 L( t( S" D
$UGII_VENDOR_DIR/startup directory
% d7 {# T) o; R8 a
- U! V n3 ?) r/ h. n
' ^7 { n7 e4 ?9 }. Z Move the contents between the dashed lines to your Menuscript file.
" w! x- J. ]* d! ----------------------------------------------------------------. d# R$ j* }7 \* j9 \0 _' [
VERSION NX7
2 m% Y$ [4 e# r1 ^$ w! r2 s l! f- I
EDIT UG_GATEWAY_MAIN_MENUBAR1 X0 P0 F9 P8 T) S* ~; o- R
9 l# E+ H G/ I' Y5 g$ @# N- t
BEFORE UG_HELP6 K6 w3 ]) G8 K7 L
CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN
4 ]- y# \8 z ^) f* u LABEL Dialog Launcher
, d. Q: U# I- p) ~& `# ? D END_OF_BEFORE
- z9 u' J7 u2 [, g. A
$ X% N9 l* {- R; n; d; L6 v MENU UISTYLER_DLG_CASCADE_BTN9 |- i. ~: y$ c9 r- `* V
BUTTON ACCESS_DIALOG_BTN, @4 G7 e( P- ~# |
LABEL Display access_dialog dialog* w0 L- A9 {" T9 v3 J9 C4 g
ACTIONS access_dialog.dlg
# |' H. [( b, ~4 @5 H+ U END_OF_MENU+ a4 y$ G$ l# E) |1 c
! ---------------------------------------------------------------
O4 v" N- W( H3 M; ^4 V
: v& g4 |- R/ C3 K" k4 {! G+ o a5 F. r/ c
2) Issue a call to the function, UF_MB_add_styler_actions from the ufsta
. ?1 i3 A0 k9 g: w user exit as shown below. To use this call, remove the conditional
0 s7 Y: K% B* X* {' b definitions: #ifdef MENUBAR_COMMENTED_OUT P, P1 i; ?0 ]# @9 V
#endif MENUBAR_COMMENTED_OUT ) N, B0 E* a9 F1 O# L
4 M9 ?8 a: P& E& ]6 d; ]. u
The static structure, actions, will allow you to associate ALL of your, i1 M% o3 U1 V! y. T+ u! H: u8 }: n
dialogs and callback functions to the menubar at once. For example, if you
9 u% [* T1 D9 u3 i: ]) A1 l/ e wish to have 10 dialogs associated to 10 different buttons on the menubar,( V& P; v+ d" w" G! ^' J/ J
you may enter each dialog and callback list into the actions structure. Make
$ O1 L& T3 P9 L. ?* P5 Y sure that you have created a corresponding button in your MenuScript file.
' ~) D! ^( P3 M9 V b: W" P2 A1 g8 ?2 n% I* d
You may also have separate shared libraries, each with a ufsta user exit
: R' w3 o2 A: o/ x for each individual dialog.+ G- V' x6 X/ U2 l
* e. d# z8 ~* z! Q/ d, Z# j/ W; p4 X y7 k# m7 o0 w
3) Place your compiled and linked ufsta user function in
( ?: S" E c3 v# T* P3 O6 d $UGII_USER_DIR/startup or - M* k- _3 c3 @8 Z
$UGII_SITE_DIR/startup or : S0 i: S+ O4 t$ Q1 T/ d
$UGII_VENDOR_DIR/startup directory. / l9 B9 S+ l3 V& q* x
* E* d# W0 P6 x4 z8 P* y6 f8 ^
NOTE: The user function must contain the proper extension .so, .sl or .dll
+ ^, }+ m& \- {1 P7 W o, H- Z9 R& j8 T to make ensure that it is recognized by the MenuScript. If it does not. ^. K5 o. J1 P) ]: s
have the proper extension, it will NOT be recognized by MenuScript.
/ y7 R# p* W' U- m; u; r
p8 m" m% H$ P" a- G5 ^; d+ o `! V/ c( o
The action name you have provided in your MenuScript must correspond to( _+ z2 k) r, K; M! Y
to the dialog name provided in the action structure. This MUST match inorder8 z3 V9 J+ R& x5 V$ z! \ [
to bind your dlg file to your MenuScript button.
( ]7 F3 }3 ]' Q$ W T* C4 \8 _ \$ ~4 S
8 j: `2 L$ ^2 J4) Copy your UIStyler dialog file to the proper directory.! k9 n: [+ u$ u# u+ p
All dialog files (.dlg) must be located in
0 K* C) U* v9 ] $UGII_USER_DIR/application or # G. v( j! N8 E7 \
$UGII_SITE_DIR/application or & `" X" K- d% ^! Q, m% V, }
$UGII_VENDOR_DIR/application directory
( [& ]4 C* M) n2 d
0 ^* E# }# A$ i% B8 o: Z& c' L: q" c7 v; _% w$ Y" P
Z. i6 @7 J3 A7 A8 F
# `' v/ v4 C* T5 P: O------------------------------------------------------------*/# b. A% i# M7 q5 O+ k0 T y% w5 m
#ifdef MENUBAR_COMMENTED_OUT
% n3 T8 F$ T5 m, I0 dextern void ufsta (char *param, int *retcode, int rlen)
2 P: y7 X" F# Z8 B& \{) A* ?, [, x* f: o+ N# C. q4 M
int error_code;
: P7 ]; M1 O' z# }+ y& j' G0 C u5 z+ {. m/ v& f
if ( (UF_initialize()) != 0)
/ c% x7 C) F7 E: X! p return;/ [: r7 t/ b2 P6 }; S! L' ~
% J! ]; A* L( y. u8 ~0 w+ z if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )
& @1 j0 _* z2 `* H2 }/ h! ] {# Z- d! J5 K6 _9 ^& Z7 q
char fail_message[133];: ]6 p) D( S& p) ~( O
$ T2 P$ e" d3 g* s/ R. u
UF_get_fail_message(error_code, fail_message);
; q H* I. q$ `6 d; |; \ printf ( "%s\n", fail_message ); ( Z" ^8 Y+ b8 l/ w" @2 b4 }
}! e' D2 e. X' e7 z+ a
. n+ f0 h$ B- T# E UF_terminate(); : h% F7 p: ~. |2 z* D' w
return;) L4 X7 y" F8 D5 \
} ?$ m* M0 l- N) B9 h, Y+ y
#endif/*MENUBAR_COMMENTED_OUT*/# L( K" d, o" y& a8 n* P
% e4 U w( `( Y, F* s
/ ?0 k0 O/ i- \6 b1 Y
2 v% X# ^9 [. H: p7 \# v
7 g/ y3 A A; B! u1 x) E+ t/ E. a+ G: n" A
/*-------DIALOG CREATION FROM A CALLBACK HELP Example ----------+ R& f, ^1 Y9 _/ e
If you wish to have this dialog displayed from the callback of " k8 ]9 L9 s6 F( P2 D+ J
another UIStyler dialog, you should:
& e3 {- u! @2 C$ c) z, D8 V% ?# Z; `' T; ^5 m2 Q, t" f2 e
1) Make sure that the callback of your UIStyler dialog is - _1 g5 ^$ ~" @4 ?( i! i
designated as a dialog building callback.
3 A# Y' V2 q' s2 m' F: h) @2) Remove the conditional definitions:
# ? L! m8 J" Y #ifdef DISPLAY_FROM_CALLBACK ( @8 O. ^* L, ?
#endif DISPLAY_FROM_CALLBACK
' U T8 j# j4 M0 {! f3) Your callback should issue a call to this function.# z; n4 }/ ?' _5 ?/ R
4) You should also add the funcitonal prototype to your header file
4 g- c2 P$ G" E+ B) E (access_dialog.h) and ensure that the file is properly included.4 L. M( k: L6 D a
3 C; ?- f3 M* {
All dialog files must be located in ( b; O" m% O* W2 `6 L1 O
$UGII_USER_DIR/application or
! F1 f4 d9 b& _ $UGII_SITE_DIR/application or ! c* `7 Q! T: a/ c$ Y9 ~
$UGII_VENDOR_DIR/application directory
E- A8 h7 p! s, T6 S- L/ B: U--------------------------------------------------------------*/
( j" }& D8 O& g1 W3 Z1 Z Z
: b+ G' J) ?* y
* r& }! K/ J/ p#ifdef DISPLAY_FROM_CALLBACK
% c7 W5 d J, ]! A7 jextern int <enter the name of your function> ( int *response )
) }0 W2 W5 ]4 p+ ^# _6 Z{% y; |, [( u2 a9 q
int error_code = 0;
. l1 `2 N. h3 Q+ i. e6 O' v/ ?/ s7 |+ O& O# ^
if ( ( error_code = UF_initialize() ) != 0 ) * a0 v6 {7 G& n8 v0 a3 g4 X- w
return (0) ;; {5 w" d" W6 F4 P- a
% ~+ [. I0 F* F2 p( K( H if ( ( error_code = UF_STYLER_create_dialog ( "access_dialog.dlg", u8 C3 P. t$ K: s+ d) B/ Y
DIALOG_ACCESS_cbs, /* Callbacks from dialog */
1 ^/ v" m4 z) X1 d5 \* q DIALOG_ACCESS_CB_COUNT, /* number of callbacks*/9 V. g2 n# d p, f5 r b: ?
NULL, /* This is your client data */5 h6 U7 G9 J2 |3 u
response ) ) != 0 ) X2 H' j5 L; ]' f! ?7 M
{
; O. P2 K0 {; G z: K char fail_message[133];
8 ]" L. n( _. l7 O' A: S. A5 C' b3 N; ~, u& A6 u
/* Get the user function fail message based on the fail code.*/
! E/ B3 h" Q) o) `6 J7 r UF_get_fail_message(error_code, fail_message);
8 Q/ M7 j: \; A' J3 o: t UF_UI_set_status (fail_message);
6 O8 ^ x" J2 x printf ( "%s\n", fail_message ); ; s" T* p! U- b' w) K
}
% X5 B; U7 d* i+ d2 b- X5 s$ y2 a1 d1 Z. W1 ^
9 j7 [! ?1 a, Q UF_terminate();
' r8 k/ E) O7 [4 l: ]$ L return (error_code);
, Q, p6 Y3 J1 s! a% I u* W}7 p/ p6 l9 l* ~* {* B( Q
#endif /* DISPLAY_FROM_CALLBACK */ & e, E0 o5 n8 r/ A8 w) ~
' C1 L. }1 F8 |& H% G# w4 H0 \
0 P; X* Y! R6 @( d, S1 L
+ S. L6 f7 T, T2 K- i
w& j+ m; x7 B7 P" v
/*-------DIALOG CREATION FROM A USER EXIT HELP Example --------! n( K6 ?5 O1 c5 M5 D' H
To create this dialog from a user exit, you must invoke a
# D" t+ m' V0 z! a; t6 icall to the NX Open API, UF_STYLER_create_dialog. An example ' [3 E$ y+ O6 N* j4 @% N9 H
is shown below.
6 F) Q5 P0 U$ |) `3 n, {+ W
+ c0 m& K5 [: W) Z2 r# `9 ]! w& QAll dialog files must be located in
. Y" n' o$ j; \+ G5 y0 W $UGII_USER_DIR/application or " w; j1 q! Y7 Y& K$ V& S. Z
$UGII_SITE_DIR/application or
5 ^4 h' O3 _4 T8 u$ ^( [& | $UGII_VENDOR_DIR/application directory
4 @3 w$ q5 a' g6 E3 ]1 e1 J
% C* i3 b$ _- h8 g1) Remove the conditional definitions:
6 ~" q7 M& Q9 A #ifdef DISPLAY_FROM_USER_EXIT
# @8 L0 M1 b( c' \% R #endif DISPLAY_FROM_USER_EXIT & U. s {: _3 t6 L
2) Add a user exit to the function name below, for example, ufusr.
. D4 B) G1 D- m2 _3) Consider how your shared library will be unloaded. Take a look) N6 V: T. k9 H% D% S. p. j
at the generated function ufusr_ask_unload.
) r4 n% W* y7 ^--------------------------------------------------------------*/
. T5 G5 k; b3 z1 I+ Z- {8 T$ V
3 E$ o4 [8 Y" y5 s4 }#ifdef DISPLAY_FROM_USER_EXIT
- n8 O( \- X& b" e9 Dextern void ufusr (char *param, int *retcode, int rlen)
$ T& A a3 N6 Z' `) H$ G{3 i4 m! i5 E# J! Q- j$ d
int response = 0;
, m, F& X6 F K8 N1 ? int error_code = 0;+ Q3 x5 `+ i; D; |+ D
( `5 i8 J6 H7 H% Q) h
if ( ( UF_initialize() ) != 0 )
( `' z6 Z; ?% q2 y) `* I; T+ g return;! W# h& B& _# _; R
2 W3 B. ^ B4 F: N if ( ( error_code = UF_STYLER_create_dialog ( "access_dialog.dlg",
5 A4 K# l( A* V$ `* p6 b DIALOG_ACCESS_cbs, /* Callbacks from dialog */5 x" P- e4 Y* U" J5 [
DIALOG_ACCESS_CB_COUNT, /* number of callbacks*/' I0 L$ n7 N# r- D
NULL, /* This is your client data */
5 q3 f" o' v% G &response ) ) != 0 )
% g# N1 _! m* o( Y {' A7 Z& ^+ G% }! I4 d
char fail_message[133];5 M1 l; b: G2 P, C! @
a% C% I! r0 ?9 t, Y- l1 Q3 {" @- Y /* Get the user function fail message based on the fail code.*/5 X: \+ ?/ r7 z/ j& q% u4 ]
UF_get_fail_message(error_code, fail_message);3 x$ H2 v) K% A4 V" b5 L5 k
UF_UI_set_status (fail_message);! {( w# E" J, q
printf ( "%s\n", fail_message ); ( V( V5 @: \1 l
}
( e$ q7 b* `/ S- n- U* Q' Y2 F5 ~( j$ J0 B
' n" |* T1 O$ `: Y/ z, ?& e
UF_terminate();
. l' _! [8 z8 ~+ p' B return;/ _: P/ b+ `: [ H; j
}
6 K5 V" J2 s1 z! A; z5 U9 {' y" g# j1 Q. R
5 g6 z9 L$ b" S# v- T* ]# ^$ z7 _+ C) r1 @* p/ F$ l
T! B8 _1 T5 r+ h& ]. l" ]/ c/*--------------------------------------------------------------------------' ~. z; \! I% A4 C% B
This function specifies how a shared image is unloaded from memory 0 c( T# i- Y7 S7 s/ F- x
within Unigraphics. This function gives you the capability to unload an / g5 r+ v% u, r
internal NX Open application or user exit from Unigraphics. You can - y' W4 Q3 ?+ r4 d
specify any one of the three constants as a return value to determine 9 M% U% h: t: K% o9 i3 {0 A
the type of unload to perform: immediately after user function
2 r' S+ }& J4 ` w* V5 vexecution, via an unload selection dialog, or when Unigraphics terminates 3 H7 X7 J A+ c8 O
terminates. If you choose UF_UNLOAD_SEL_DIALOG, then you have the 3 B" B! q! d: H! i
option to unload your image by selecting File->Utilities->Unload Shared ( X. j* b* y4 @! s" T* t2 j
Image.
* n, h# |! I( O, {
$ J+ \# u1 r% M# s- t4 Y% \) y! VNOTE: A program which associates NX Open applications with the menubar
6 c, h, a, |/ j5 v$ l( O* nMUST NOT use this option since it will UNLOAD your NX Open application image& }) @# Q+ K5 D; T
--------
9 C0 n, |5 z5 v5 P( W Hfrom the menubar.
, r! j+ S5 y) P, F( k9 V; u--------------------------------------------------------------------------*/
# y. F! m6 L& S+ k; A. J, |! k& k- o' I+ }% ]. K. I: r
extern int ufusr_ask_unload (void)
+ W9 R* i6 g( D' Z( c+ a{
8 p7 A r6 h7 \1 s) _+ } /* unload immediately after application exits*/
3 v2 M0 _3 u4 ? [9 G, @" c3 J return ( UF_UNLOAD_IMMEDIATELY );
- V' Y: W9 i) ]! f$ V" N0 Q: ?7 C9 f
& _+ S4 T# a& W5 K3 E /*via the unload selection dialog... */
7 W- w+ | P- s6 k4 h /*return ( UF_UNLOAD_SEL_DIALOG ); */$ ]& t6 O" k& M6 o; H* Y
/*when UG terminates... */! {6 y; {) w: }9 p9 U8 H4 @
/*return ( UF_UNLOAD_UG_TERMINATE ); */* s. Y" E. e y/ v5 H
}
1 I' F0 z5 {7 f3 ?; h7 F h, R5 P1 d
0 b& W; L5 ^, q7 |" ^% V
( x/ H0 N9 ?1 J1 m
/*--------------------------------------------------------------------------
5 K9 x( J0 S% Y# G7 x& iYou have the option of coding the cleanup routine to perform any housekeeping, K- o0 y* t/ N6 i8 a
chores that may need to be performed. If you code the cleanup routine, it is& Q; S. K% i3 _ G! o2 H
automatically called by Unigraphics.
3 r( f4 A0 ^0 D1 q& G--------------------------------------------------------------------------*/9 p* C+ m7 m, }" B
extern void ufusr_cleanup (void)
# E; g! K/ m; B: r; G{# F! g' W3 V6 ]2 ` J
return;+ P. S' f+ }' ~- o( Q
}1 Z- d/ j( o1 Y0 g0 a. d c
//#endif /* DISPLAY_FROM_USER_EXIT */ & ?+ X# i! b: }6 n
1 F1 c9 {6 T `+ {: `* x
4 ~( D9 H, ?2 }& x
; x. {/ z8 F" K" S* W* }1 x
5 `: H6 U+ k$ H- ?" I: ~) h
) a2 X9 h: _/ X( T$ P
# h* k) I9 {' C' V5 N* e: o/ K4 ]; n/*-------------------------------------------------------------------------*/ m O) k- ~0 o# V3 |3 v
/*---------------------- UIStyler Callback Functions ----------------------*/5 G3 S1 D4 `5 B# q9 F- K4 U# I0 M
/*-------------------------------------------------------------------------*/* L) w8 O2 | V! ]2 Z5 v+ M# k
8 O( `3 x. c+ ~/ b h3 G! [/* -------------------------------------------------------------------------( C( K% u5 ?2 G8 ?
* Callback Name: DIALOG_ACCESS_back_cb U7 p1 J- j7 n
* This is a callback function associated with an action taken from a1 A3 |6 j$ A7 | y
* UIStyler object.
7 x9 P' ^) y; y8 J# A5 N; i; H *- E. M# K% k2 Q
* Input: dialog_id - The dialog id indicate which dialog this callback7 q0 { u2 G2 X3 s8 w1 j
* is associated with. The dialog id is a dynamic,
8 `! ?! C& ]8 i7 |5 x3 W* H" { * unique id and should not be stored. It is$ y3 a" I% ~/ T/ e3 O
* strictly for the use in the NX Open API:
; P8 ?/ d, d; u+ Y. \" p1 K, U7 P * UF_STYLER_ask_value(s) $ ?+ j, @1 O I1 H6 e g/ ^$ q3 d
* UF_STYLER_set_value 7 k ?! m7 z4 s! O* Q
* client_data - Client data is user defined data associated
- _6 ]7 ^1 n1 ~7 T% b6 c1 C: V * with your dialog. Client data may be bound
: g% V! h' K! b1 t+ ? * to your dialog with UF_MB_add_styler_actions
( F5 n7 c& [6 E: e * or UF_STYLER_create_dialog. 6 h' u4 l( i3 B+ I( P
* callback_data - This structure pointer contains information- y- {0 A$ i3 ~: ]. J5 O
* specific to the UIStyler Object type that + J' r2 r2 c4 R( [
* invoked this callback and the callback type.
4 h8 Q* T9 q! g P9 S6 t* W) z * -----------------------------------------------------------------------*/$ ?5 {* ~; O1 I$ c+ F$ {
int DIALOG_ACCESS_back_cb ( int dialog_id,8 _' Y! f( ]! @- }$ \
void * client_data,
7 k+ w- K- p) f. ~0 E2 B UF_STYLER_item_value_type_p_t callback_data)
; G. Z% q' M7 Z; I% `) o3 Q{. M% @, s8 o3 a: R2 x
/* Make sure User Function is available. */ ! O% J2 i% _% B o
if ( UF_initialize() != 0)
1 X. B! [7 H# j3 e x return ( UF_UI_CB_CONTINUE_DIALOG );1 [- v5 K: g5 B* i/ z/ `
( g! m7 \/ ~+ J. f3 M7 B: I" \" I /* ---- Enter your callback code here ----- */' U) s* v5 O) w! X8 w$ Z$ I
uc1601("您将退出对话框!",1);
; ?: t% t! U- l) N UF_terminate ();( D' G) J. ~# ]
) r; ^" d* t) h5 i7 ^- b# W /* Callback acknowledged, terminate dialog. */
1 O; D* p5 C9 I6 B, C+ h, m5 v /* It is STRONGLY recommended that you exit your */" t9 b9 O/ Z* h3 C4 I
/* callback with UF_UI_CB_EXIT_DIALOG in a back call */
/ d9 @* v% ^6 d2 J7 J" Y' A /* back rather than UF_UI_CB_CONTINUE_DIALOG. */
# e& u- p p# O5 U' z return (UF_UI_CB_EXIT_DIALOG);
) m B' [& {+ h+ f9 l; L( I
. c M: u' w, j, K
$ x- `1 V% G9 y7 d$ @4 |9 \; i}
+ E, L6 i0 o: E; ?8 l9 Z# t& E+ h' Q' Z/ z: ~1 q( P
/* -------------------------------------------------------------------------
0 I* }( h% {3 W6 s$ ^' y" h& l9 n * Callback Name: DIALOG_ACCESS_button_cb0 D( K! K" n) {( i" R
* This is a callback function associated with an action taken from a. f8 q' l A" v/ X2 ]& V
* UIStyler object.
8 I* ?! T, {8 c *
' c" z6 f6 g( g. d/ u; r * Input: dialog_id - The dialog id indicate which dialog this callback
" c' C2 k* Y, V) N! S# J * is associated with. The dialog id is a dynamic,
2 Z% E* e+ n- ], h5 x- g" w* l- }: ] * unique id and should not be stored. It is
* P0 x0 V- a, c* B4 ~$ A# R * strictly for the use in the NX Open API:
8 a1 {( k; n8 I$ U * UF_STYLER_ask_value(s) F. ^4 M% K2 w( n2 p$ B
* UF_STYLER_set_value $ t2 u7 b. S7 y
* client_data - Client data is user defined data associated- L% N, m0 I- \1 H" X
* with your dialog. Client data may be bound; I( ~2 K" z. _
* to your dialog with UF_MB_add_styler_actions
3 ~. s- ? y9 m% Z) f$ c& N * or UF_STYLER_create_dialog.
2 m6 T6 m3 L. H5 L/ { * callback_data - This structure pointer contains information! t+ b. F- |/ K
* specific to the UIStyler Object type that
/ J3 j5 V/ \2 ^2 L( f: a * invoked this callback and the callback type.
2 A+ X( F2 ^ r5 E, Z- u * -----------------------------------------------------------------------*/1 w( y' D. X9 c2 V5 S; T
int DIALOG_ACCESS_button_cb ( int dialog_id,1 B- v C* A# k3 D
void * client_data,
9 B' @4 w0 H! R4 g5 K/ a UF_STYLER_item_value_type_p_t callback_data)
% h+ U2 r, | f7 T* T{
, ?5 o; [ {3 ?! m5 m( X5 ]- z /* Make sure User Function is available. */
$ E# o) @% ^8 o/ P6 W9 ^ if ( UF_initialize() != 0) 1 @6 P' X1 @4 S+ C
return ( UF_UI_CB_CONTINUE_DIALOG );' H5 J1 z; |, u; L# S7 M1 U" T7 V
! F; ?! R$ w/ u /* ---- Enter your callback code here ----- */
: r0 p' J4 d# I- Y% n UF_STYLER_item_value_type_t data[3];
( v4 ^& y/ s0 B1 {+ b9 p char info[100];5 U8 p% P, b% F' L6 U
. C8 H K. k' t8 j) ?2 A- X
data[0].item_attr=UF_STYLER_VALUE;, b2 G+ q6 p, p
data[0].item_id=DIALOG_ACCESS_INTEGER;
! o. B0 T) m/ j/ f( L9 e- R UF_STYLER_ask_value(dialog_id,&data[0]);6 }$ p- ?8 v8 ?
) V' ?$ y: [( V9 l' { data[1].item_attr=UF_STYLER_VALUE;- s& @% H0 ?: z: u
data[1].item_id=DIALOG_ACCESS_REAL;! N6 Q& g- x/ H& h
UF_STYLER_ask_value(dialog_id,&data[1]);
4 m* Q7 r* C$ U* B, v
m. C+ I- q( ^# G2 E) A data[2].item_attr=UF_STYLER_VALUE;- t; W( J/ H6 ?) x
data[2].item_id=DIALOG_ACCESS_STRING;
& ~% B) v6 L9 U2 u& ^, i$ v UF_STYLER_ask_value(dialog_id,&data[2]);* `; G8 S0 r) k. ^, @$ z/ X
& r. a. d: L( o; A& A7 A4 r sprintf(info,"整数为:%d\n实数为:%f\n字符串为:%s\n",data[0].value.integer,data[1].value.real,data[2].value.string);
, q6 A* L' S8 m3 M7 F8 s0 V$ X
$ H7 B0 |) a; S3 N9 L uc1601(info,1);" B, Y9 U8 A) f2 [/ _2 w
6 T8 Y$ M) ]- S- B UF_terminate ();% n5 a2 d5 T1 f# S( l. M
8 _6 d( w1 a Y) e# H- a( x
/* Callback acknowledged, do not terminate dialog */
8 D; ] L) S4 U$ ]# _ h return (UF_UI_CB_CONTINUE_DIALOG);
C7 { h6 l3 O9 n4 A5 G
# F3 ~2 R9 I" a% S8 V! i( H3 f5 ` /* or Callback acknowledged, terminate dialog. */8 a' g3 q5 x/ A
/* return ( UF_UI_CB_EXIT_DIALOG ); */; a4 A/ R8 O2 U: q, @$ K
}" p. G# q3 Z: I! b* p; j7 `0 G
, r4 t, P) r9 B3 X" c3 I: f! B |
|