|
刚刚进行vc++与ug nx 7.0二次开发 在编对话框访问时生成dll 但是使用nx open后调用dll 然后出现“缺少需要的库内存 功能ufusr”
* G( A: ~# A6 ^亟待解决啊
7 j& a0 t+ K7 X7 }4 L2 X1 Y附代码:
/ w: ^4 h$ Y. }) [4 h8 D0 w/* These include files are needed for the following template code. */. ^3 T* [, j; P8 L& v; W
#include <stdio.h>
( d( }- F9 H% D2 e6 i% m#include <uf.h>
+ N7 |: p/ L5 D' N; [: v#include <uf_defs.h>8 v; R+ U2 I+ I: G. u
#include <uf_exit.h>
$ B- V7 ? E4 `6 _& Y0 ]7 s& \#include <uf_ui.h>
6 l! v' D% h1 n1 F& U8 P z#include <uf_styler.h>
; Y, Z7 u9 e: I#include <uf_mb.h>
5 T& }. V9 Z$ U9 e+ R) W! m#include "access_dialog.h"
B) O0 H- d* e$ r* R7 B+ B1 U, } W( X; l
/* The following definition defines the number of callback entries */( U5 i+ l% [/ h6 O7 _ l- g' X) v
/* in the callback structure: */ V& Z" {. R) z3 ~! d: O* q
/* UF_STYLER_callback_info_t DIALOG_ACCESS_cbs */
" o: q$ A: [( K F( ^6 a! x. C6 E#define DIALOG_ACCESS_CB_COUNT ( 2 + 1 ) /* Add 1 for the terminator */
8 F) R- E- {1 b9 k/ l2 d3 [ X. {2 W2 n/ I& R2 w0 Y+ ?
/*--------------------------------------------------------------------------
) Z6 j) D( n' ~0 t7 l$ vThe following structure defines the callback entries used by the 6 b' I F4 H# @
styler file. This structure MUST be passed into the user function, ) m9 `+ U1 [* c1 n
UF_STYLER_create_dialog along with DIALOG_ACCESS_CB_COUNT. + Q4 z! K7 N' ]. x( t
--------------------------------------------------------------------------*/
4 h$ T0 \; X# }static UF_STYLER_callback_info_t DIALOG_ACCESS_cbs[DIALOG_ACCESS_CB_COUNT] = " ^0 s' g; T( J! |4 M+ r
{4 V& C6 G+ |+ y; y$ _) E
{UF_STYLER_DIALOG_INDEX, UF_STYLER_BACK_CB , 0, DIALOG_ACCESS_back_cb},) J. F1 L+ A$ ]7 Z- m4 _9 g
{DIALOG_ACCESS_BUTTON , UF_STYLER_ACTIVATE_CB , 0, DIALOG_ACCESS_button_cb},$ A) c i; ]! ?/ z6 e A' Y
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }3 Y1 F! x' P) M. O6 }
};
c. R5 ?+ s; V$ J( B, X+ h- M7 n* F# Q5 f' o$ i+ ~8 L1 I, t
0 ?( \5 w; s! O, S4 l2 F
& |& j4 e) [' g+ E, h/ D
/*--------------------------------------------------------------------------# Y5 d5 k' g ]/ u6 L3 [+ g* s
UF_MB_styler_actions_t contains 4 fields. These are defined as follows:+ n. C4 X7 e. O9 _: H0 j* _% o
- N( L8 W2 v E# j% f; _7 X9 t
Field 1 : the name of your dialog that you wish to display.
* Y' n ?7 x0 W1 RField 2 : any client data you wish to pass to your callbacks.
2 ]5 s( P, j* NField 3 : your callback structure.( ^$ I+ T7 j! e. o; I
Field 4 : flag to inform menubar of your dialog location. This flag MUST & i u1 i) J5 ^3 g
match the resource set in your dialog! Do NOT ASSUME that changing ' E# i7 o g: h4 h- N
this field will update the location of your dialog. Please use the - v9 j* l9 Q- i- l2 K
UIStyler to indicate the position of your dialog.: |* t! g4 d* R/ N: {9 {
--------------------------------------------------------------------------*/
4 `! k" j0 b+ Y* |5 w- H3 c& gstatic UF_MB_styler_actions_t actions[] = {
$ X+ T8 V" r9 ?( H { "access_dialog.dlg", NULL, DIALOG_ACCESS_cbs, UF_MB_STYLER_IS_NOT_TOP },: \# {6 I! Q& d1 x6 a
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */
3 a* k) ^' r: F};
( j5 h! _9 }- a' K% a- L* I6 B( L# J' W& [
1 A8 L# K" X0 U7 z
+ ?) B! E k3 {/ r0 g% y
6 U5 e" K" z2 M& K9 B+ n% X1 {
; R3 _% o+ B/ E$ U; m
W6 V# M- o# `' J3 L' c
2 {& G, v9 T8 r- g! n Y4 ?) T) H! ]/ c: ~# W/ \) z$ Q7 \
/*---------------- MENUBAR HOOKUP HELP Example -------------------
' k% H4 F w- g+ G& H1 r& jTo launch this dialog from a Unigraphics menubar, you must follow 5 }9 k2 H: u6 n. }2 ]( F$ k6 s6 y/ Q
the steps below.! E+ L" O% ]: ]% F9 c2 P4 r' H, @% I f
1) Add the following lines to your MenuScript file in order to
( H6 C5 N' |1 s4 @6 f6 k' k; s: M# W associate a menu bar button with your dialog. In this
2 N# P1 `5 y0 p1 |2 K, f, g3 \ example, a cascade menu will be created and will be 1 q' p# I6 i# I1 p& a; P
located just before the Help button on the main menubar. , n9 F O. F$ s, X/ V( V9 v& f
The button, ACCESS_DIALOG_BTN is set up to launch your dialog and
( T' E) X J8 w will be positioned as the first button on your pulldown menu.
R( E ]8 `' D! z* x" n If you wish to add the button to an existing cascade, simply & C, [3 w: U) b
add the 3 lines between MENU LAUNCH_CASCADE and END_OF_MENU
2 ~5 M) K& f# S& R0 R% C$ S to your menuscript file.
& y$ T6 i; N, g6 C. n
4 P9 d4 _7 c. L% y The MenuScript file requires an extension of ".men".
- a% e; E: J6 ~" N, z Make sure that you add the extension to the file and place 0 n: o8 V1 K! S1 f$ f" `; x0 Z/ l. T; s
the file in your startup directory:0 V7 ]/ d, A5 |4 R
$UGII_USER_DIR/startup or
& g/ k* U2 v/ ]. H; n $UGII_SITE_DIR/startup or
" q, |; E7 a% e7 w$ a) U $UGII_VENDOR_DIR/startup directory
9 |* I# {' M) E @% D1 J7 u1 } T
- D2 s1 `/ G/ M Move the contents between the dashed lines to your Menuscript file.
6 N; S; M7 u: w7 H4 y$ s! ----------------------------------------------------------------0 {8 ^$ W2 |: f, y: v" X
VERSION NX76 i, D9 r d; F# C! c' W# e6 O
: R/ L5 K, K# n* |& a% d EDIT UG_GATEWAY_MAIN_MENUBAR: T/ d$ p) [ K. F& @
) j- y8 F4 G9 o6 P: J) {
BEFORE UG_HELP+ M) U$ I: K# Z. p1 F" [ L" K
CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN
4 I/ ~9 ?; n: O. Q/ l; `3 ~ LABEL Dialog Launcher/ B9 ]- p: v1 H! \
END_OF_BEFORE
& S4 k4 ?; k. Y, Y% X, D# e* b2 X, s/ `2 K7 ^& _7 B+ O
MENU UISTYLER_DLG_CASCADE_BTN/ C, K+ h1 K! f- c, m
BUTTON ACCESS_DIALOG_BTN$ b0 Q8 I: |6 N& p3 G I, L
LABEL Display access_dialog dialog
5 F! H, n# W2 U, Q. d; c ACTIONS access_dialog.dlg
8 e' B. O. o6 V# E END_OF_MENU
; M D. F6 f7 ^; e8 m! ---------------------------------------------------------------
/ n0 S T# \: ~" s/ L% `% \& `. E( z. B8 A8 E3 E& w$ F( p
& v: H# ]( Z4 `, p# ?% e9 D2 g2) Issue a call to the function, UF_MB_add_styler_actions from the ufsta
5 v) Q$ @! ^- ~/ g9 c2 ~ user exit as shown below. To use this call, remove the conditional / z9 R+ k9 z* y8 ^
definitions: #ifdef MENUBAR_COMMENTED_OUT 5 g. o W! A+ X x+ t* v' R4 l
#endif MENUBAR_COMMENTED_OUT % B+ C7 T& j& ~/ Y3 f+ }" ~! `( {
S/ h) O6 K% e, p The static structure, actions, will allow you to associate ALL of your
l% x9 d4 C5 F; | dialogs and callback functions to the menubar at once. For example, if you % B# _) A9 ^& x2 p' x& s
wish to have 10 dialogs associated to 10 different buttons on the menubar,6 g( d" E4 y: l p2 ?/ q! i- f
you may enter each dialog and callback list into the actions structure. Make
: @2 L& q |, H# v sure that you have created a corresponding button in your MenuScript file.
" t- x: n0 e5 Y% k% K
, d* e* G. a) y" R6 v7 {* v You may also have separate shared libraries, each with a ufsta user exit/ ~( u' z% u3 i' w( N' L! L
for each individual dialog.
& S$ u. f1 S; C4 f4 C* c q4 l1 l6 l0 Y" @" r9 x J
% v; [2 G/ s2 P4 Y! X4 N: c/ _! `
3) Place your compiled and linked ufsta user function in . E+ s6 l. M) K
$UGII_USER_DIR/startup or ; x) h7 p7 z9 O, d) p4 e6 P4 b" W
$UGII_SITE_DIR/startup or
, _5 j& ]' G- H $UGII_VENDOR_DIR/startup directory.
9 z3 D5 U8 G1 m' P3 b
! k' i/ V, \% a' ~# b/ k NOTE: The user function must contain the proper extension .so, .sl or .dll , w: \( C( i0 |! |3 S H: W0 z
to make ensure that it is recognized by the MenuScript. If it does not
5 Y- [. ~8 m* U9 [5 s/ [' I have the proper extension, it will NOT be recognized by MenuScript.
* q) ~+ |) o$ D. L" Z X; x. d# k# R% C; q& Z; K( Y6 |
6 n! }5 J( L$ y The action name you have provided in your MenuScript must correspond to
5 `% K1 h [2 Y% Y: z to the dialog name provided in the action structure. This MUST match inorder
: `' B% c3 [6 ]4 q to bind your dlg file to your MenuScript button. $ V- \4 }5 y, p* n) _4 S/ |
3 `7 x: \( H; s
- q- D0 K" H( W, S4 x4) Copy your UIStyler dialog file to the proper directory.5 J8 Z8 s' k7 ]7 O4 Y
All dialog files (.dlg) must be located in ( [* {- c/ P, k e% W
$UGII_USER_DIR/application or
7 N, U2 C9 `+ c9 ?+ X $UGII_SITE_DIR/application or
! {, _0 f) O6 x $UGII_VENDOR_DIR/application directory
# ]1 k: G& F8 t9 V
. s, A1 Z: W0 f8 E- y1 K. ?
0 J1 h% c& _* I& k [
3 e( D, S( M; _+ K0 R0 [; a3 [" `* j$ x3 Z
------------------------------------------------------------*/
0 i6 S, a6 ^% r- E% e* s$ S#ifdef MENUBAR_COMMENTED_OUT
; S- F0 `* f0 h; N8 G. Pextern void ufsta (char *param, int *retcode, int rlen)7 t3 J: w8 j$ L% q+ ?' f1 N) m) g
{
; M5 q( Y: O8 a% G& O9 w int error_code;
6 J" F* b$ x; F- D% M) e
5 B/ g0 S) M- G2 R if ( (UF_initialize()) != 0)
7 H; r+ T/ {9 \& y$ U return;# o \" _6 w% x' ]% X$ ?) k# F
z# Q8 ^! G: q- A if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )+ ?+ O. ?) I/ r" S- W. O8 o
{
, o! r3 _( f3 ] char fail_message[133];5 z" l+ y& P c! c& S
9 m& {- Z) ^! b& t) G UF_get_fail_message(error_code, fail_message);4 f" @, I; \) F" S6 G* o
printf ( "%s\n", fail_message ); ( R( c5 p% W* o
}
' M6 d" L. o: T6 _
3 W9 Q1 G4 T; y) C7 v UF_terminate();
6 s* f% ^2 d* P return;* I5 k6 U1 J2 D& i- W
}
: O: B2 \* d: R, }) ]. W/ V #endif/*MENUBAR_COMMENTED_OUT*/
" N. g f# s3 a& d0 _
- E* G. Y' \6 o0 s4 s. m% _6 r% N) X* f' O; k' V
" P Z ]- C- m; \$ y- }& A+ E1 o# w% K- e. d
( p0 j/ b7 \( l0 v1 ?& a1 W/*-------DIALOG CREATION FROM A CALLBACK HELP Example ----------1 j# Y6 w# ^0 B, e: D( R
If you wish to have this dialog displayed from the callback of : b8 j! v/ ^ C; E& B
another UIStyler dialog, you should:
/ Q9 T8 r% Y' F
6 c' _8 j R8 i, x( G1) Make sure that the callback of your UIStyler dialog is
% E, q9 E5 e" b" } designated as a dialog building callback. 4 p) ^: i* A4 |4 o
2) Remove the conditional definitions:4 R G8 ]: n! W. M& v9 n( S5 n+ H: B
#ifdef DISPLAY_FROM_CALLBACK ( l8 w e; m0 Z3 a5 n+ F1 x- c
#endif DISPLAY_FROM_CALLBACK
9 _- Q# u: m* h) D4 r3) Your callback should issue a call to this function.
7 Y" \$ M. p m& r }% x4) You should also add the funcitonal prototype to your header file `2 ^* ?) n* u' K% D6 {% z
(access_dialog.h) and ensure that the file is properly included.
: L% z X/ q% x$ W* S' c2 o# {& n9 J3 a4 F& h$ T
All dialog files must be located in
& \, b6 b1 A7 d& a. ^ $UGII_USER_DIR/application or ' u) y8 e5 x- C6 S @& G
$UGII_SITE_DIR/application or ' A a# y) ?1 V$ N: I& ^
$UGII_VENDOR_DIR/application directory1 ]6 j. l |$ h/ A4 m" s
--------------------------------------------------------------*/
/ U6 h" \; } U5 B5 |% C1 b1 B( ?, }0 ~* V
/ o }7 z: C/ y6 S' i#ifdef DISPLAY_FROM_CALLBACK
- q0 P% _. h, s7 u" fextern int <enter the name of your function> ( int *response )
( a; _+ u7 \# z) `* Q* z{5 e2 H; D' T8 ~' Q6 i. s% e6 f
int error_code = 0;
" Y- l6 h$ ^: }- Q+ P3 V
+ j7 G3 I4 j; i7 n0 R$ X! W U if ( ( error_code = UF_initialize() ) != 0 )
. y( F s! O- z8 c# V/ f z" G return (0) ;
+ z$ w/ v7 b" n5 o
: ]( X. M6 r5 B# o+ H if ( ( error_code = UF_STYLER_create_dialog ( "access_dialog.dlg",: Z7 d* @( U' g/ N6 @/ R
DIALOG_ACCESS_cbs, /* Callbacks from dialog */
7 _8 K8 D5 E$ P+ v8 `4 } DIALOG_ACCESS_CB_COUNT, /* number of callbacks*/8 @1 z& J5 R7 g6 e
NULL, /* This is your client data */
6 q7 ~ G" v* }6 G% v response ) ) != 0 )
( J6 j7 u) a- A0 @) E6 V- l( l! A {- x: J- u1 }, c5 w( x2 }+ a+ U# E
char fail_message[133];7 ~7 `5 C( [' @
2 l0 Z. w. d0 E8 w+ I
/* Get the user function fail message based on the fail code.*/
$ W! }( ~( t0 K! u UF_get_fail_message(error_code, fail_message);3 Y; E% x/ K! u) |, B# x6 @% N
UF_UI_set_status (fail_message);8 D1 {% z! S; N3 j* U# f
printf ( "%s\n", fail_message ); / z* C4 O7 }8 H; ]+ R- ^8 _9 J
}, T9 e. T4 B( X! x2 B8 X9 N& U
: u% B) V+ R0 _: Q- E7 u8 O5 P& J7 J2 T7 h3 m
UF_terminate();
) A; F/ p k9 U return (error_code);+ n6 I. ~( H! d0 T N5 r
} E8 W) {: G0 c0 y4 s
#endif /* DISPLAY_FROM_CALLBACK */
) e) a; D0 `2 G4 w& _; e/ N1 J# f2 T# {
9 {( Z K( K: l7 A- r/ I: V
- T1 e) H; @ ]4 o7 q1 V: g& h0 v0 ^2 U# D7 c4 D
/*-------DIALOG CREATION FROM A USER EXIT HELP Example --------
: R5 s+ `+ R7 q; e' KTo create this dialog from a user exit, you must invoke a
, O# C/ F2 I/ \: Pcall to the NX Open API, UF_STYLER_create_dialog. An example ( P# W( {, `" D5 g. O
is shown below. 2 M. _& s5 Y+ O
1 F d* z% H }( h0 M4 A' cAll dialog files must be located in
1 O; F6 \7 Y) L# u $UGII_USER_DIR/application or 1 A, _7 e" C( F( I- j5 v3 \
$UGII_SITE_DIR/application or
3 L8 b: P& U% _; B$ W( Y $UGII_VENDOR_DIR/application directory
$ n& u9 L6 g% s& G! P( {- ]5 x! A& B! j% z- \
1) Remove the conditional definitions:
/ c3 v' z* Z3 t B( Q #ifdef DISPLAY_FROM_USER_EXIT N c2 Y) f" q2 a) l! f
#endif DISPLAY_FROM_USER_EXIT ' {) n9 Q- c6 A. d
2) Add a user exit to the function name below, for example, ufusr.
1 I7 X3 [. L$ X) e: t& k0 I3) Consider how your shared library will be unloaded. Take a look/ K1 ?8 R) _" z4 j6 F6 d, d
at the generated function ufusr_ask_unload.$ V' C# Q) V8 q9 I8 [5 V) t
--------------------------------------------------------------*/
: V$ W& Q4 C1 Y0 y
1 T, {( A* O5 Z: W#ifdef DISPLAY_FROM_USER_EXIT
- l. L0 ~7 ~8 M' c( R a& Yextern void ufusr (char *param, int *retcode, int rlen)* c* A6 L& O% l; p
{
; t/ r: F+ z" G/ b3 E8 O int response = 0;
! p: j9 F! |; }' R' \ int error_code = 0;
$ P I' D& f+ _4 h
; x8 W! O0 E. z% i" G if ( ( UF_initialize() ) != 0 ) 4 o) v/ f7 }; ]8 I5 V% _. k
return;
6 d& B( E1 u6 v- C/ P: B% `; k) m
" E: m M0 M6 O$ n: |8 I8 U% j; Q if ( ( error_code = UF_STYLER_create_dialog ( "access_dialog.dlg",7 G2 o0 b# i [ Z6 T! A
DIALOG_ACCESS_cbs, /* Callbacks from dialog */
9 g5 h* a: c% ] DIALOG_ACCESS_CB_COUNT, /* number of callbacks*/
) a3 L: @# r" m, H; h# o. c) w NULL, /* This is your client data */
% o8 c0 @/ u! O &response ) ) != 0 )
; _& W5 U) D7 u2 C {3 f) m* ^0 Q) d: \, v
char fail_message[133];
( u: G) |3 w! e7 x) x3 H- `& [7 }2 T$ `
/* Get the user function fail message based on the fail code.*/
9 ]& ^4 g4 S W* Y6 L UF_get_fail_message(error_code, fail_message);4 P7 E4 V2 h3 V4 r7 ~/ F
UF_UI_set_status (fail_message);
/ Q, ]( r9 [; w" x5 @7 E! k+ j printf ( "%s\n", fail_message );
2 p4 R" z4 X( q: S7 B1 v! K }% y* h$ M$ s! v# ?
" Y: R4 q# C. k5 b5 S
# P' S4 b: q) Y) U* }0 U2 K; y UF_terminate();
& I Z" ?+ o' ?1 L/ u return;
6 y+ N8 u# C, `4 N& H; q3 Z}: |$ H5 ^( e$ w% ^9 }; {
1 @' `2 u/ o' T6 \
. J# `3 a! g) x5 L- T$ u$ N
* l# e/ V: A* R) ^$ h0 @3 k9 U9 u" B7 c6 L0 \
/*-------------------------------------------------------------------------- K$ R3 g4 M: B, w6 ^) g3 B# z6 }# d
This function specifies how a shared image is unloaded from memory - [8 r0 s* S& h/ G" C
within Unigraphics. This function gives you the capability to unload an & J: |8 u# c. o
internal NX Open application or user exit from Unigraphics. You can
^0 b5 l5 w/ Rspecify any one of the three constants as a return value to determine 9 J% q# U. u. O" G7 b% M
the type of unload to perform: immediately after user function 3 S% S8 q# w$ ?9 s; D: S2 I
execution, via an unload selection dialog, or when Unigraphics terminates
4 x$ K( p& v: x4 ?( Y& @terminates. If you choose UF_UNLOAD_SEL_DIALOG, then you have the
8 y) p- M5 p2 [" B6 ^# Z* C% v5 Foption to unload your image by selecting File->Utilities->Unload Shared 0 B3 j+ F; E% ?3 |' w1 r# D
Image.
1 P9 r( @! U7 j( z. u
4 y! |* [/ W/ T& h: lNOTE: A program which associates NX Open applications with the menubar " L8 D4 c8 B- t8 f% w( Y3 N& \
MUST NOT use this option since it will UNLOAD your NX Open application image
" P( p- r+ e! @3 m' l! g7 K--------
! V+ e2 q) C$ efrom the menubar.& T' e. L$ D; ^# v- ` R$ `/ k$ k- E
--------------------------------------------------------------------------*/! i1 p2 s Z) R4 I r* B4 t
3 b! ?( m. `1 ~
extern int ufusr_ask_unload (void)$ y+ D& D' B" w# \2 [! |
{! e2 P2 k; P9 P7 r2 {( q$ k# A
/* unload immediately after application exits*/ \1 c- r. F" V8 _4 \
return ( UF_UNLOAD_IMMEDIATELY );
. e/ W9 w. B Q# ^2 p9 v. j
- i }# F$ G+ h- _4 K* K; R /*via the unload selection dialog... */9 Y" N8 \5 v7 a. g* O1 S
/*return ( UF_UNLOAD_SEL_DIALOG ); */! t9 R$ c7 q% y6 U7 M& [% Y
/*when UG terminates... */8 m! _! |2 x& [5 F) D( e
/*return ( UF_UNLOAD_UG_TERMINATE ); */( a% o. k' f3 E$ u
}
- N: g9 m7 S' u" J; I( `0 @) h; i9 Y* r3 }6 ]) z7 g9 g( Y( @* m
0 }3 S- }4 a$ @- J
) [$ N) J) `3 m& v9 j/ d! s% @% t7 L/ _/*--------------------------------------------------------------------------
7 ~' t3 _/ F) yYou have the option of coding the cleanup routine to perform any housekeeping* b% t. F% _ x ]3 e) U, n
chores that may need to be performed. If you code the cleanup routine, it is
0 e3 g$ w( E: L/ D5 D, e* Zautomatically called by Unigraphics.$ _* v) e; i5 x7 I# I& S
--------------------------------------------------------------------------*/
) L8 M. ?4 T6 r+ c% Y0 o- lextern void ufusr_cleanup (void)1 p! p$ |3 i3 N9 ^: T6 w, T. k
{9 p1 R# { T3 E0 z
return;- Y1 T. V1 R' G
}: y. o+ y7 z/ a5 V) Z3 X( s
//#endif /* DISPLAY_FROM_USER_EXIT */ 5 F8 b. f: T+ I }2 v9 s
- l& u) {4 F0 l9 E: F& y4 E0 i) Y
. J1 a: X9 a1 S. u4 Q- |
& a$ l& s2 q1 p* t; ^" `0 \- [# I5 K' V+ N( t; d# \
/ @. v' p. U+ c; ~
# Q& @7 {% }4 j- i4 z# E
/*-------------------------------------------------------------------------*/) C1 H( v" \8 f: j% T0 |
/*---------------------- UIStyler Callback Functions ----------------------*/
, k$ x* j4 N, ^/*-------------------------------------------------------------------------*/
G. p8 \/ M8 \ v, N9 y% L1 U' @. {! {: J
/* -------------------------------------------------------------------------
+ `. `; e! H# c4 \, ]5 B * Callback Name: DIALOG_ACCESS_back_cb
) k2 w1 G8 [- l * This is a callback function associated with an action taken from a
* J( M' q4 |" I& \! P2 V * UIStyler object. ! R" k7 }/ }" L
*! m9 d/ v/ I7 u6 D4 i
* Input: dialog_id - The dialog id indicate which dialog this callback) r& V" ~- e8 E9 C0 b
* is associated with. The dialog id is a dynamic,, ]. I$ U N( f# U
* unique id and should not be stored. It is ~" v8 ], ?& M j9 @. ?$ a9 b/ I! u! q
* strictly for the use in the NX Open API:
$ B3 r" t) l0 ~& F8 G * UF_STYLER_ask_value(s)
4 \5 d. w/ O3 q$ @0 V9 D) w4 q+ P * UF_STYLER_set_value
) h+ P% D/ S) e$ Q% ?4 p * client_data - Client data is user defined data associated
) H# M7 H6 v0 l' Y% ?7 m * with your dialog. Client data may be bound; K- h. ]7 @ C! A3 d
* to your dialog with UF_MB_add_styler_actions! ^* U2 Q& l, G' g! n3 Y! N& ^
* or UF_STYLER_create_dialog.
. O" k3 B7 T! c8 H7 L0 K * callback_data - This structure pointer contains information1 V5 {6 f$ `5 ?7 M( E" I0 O
* specific to the UIStyler Object type that ; t; j3 X/ x% V* X w! F9 T
* invoked this callback and the callback type.1 p5 f( a3 \6 }8 i
* -----------------------------------------------------------------------*/
" D5 r% T+ t7 g% T3 j/ i! x0 Y9 Sint DIALOG_ACCESS_back_cb ( int dialog_id,
: \% M( o( G3 _0 G1 t3 K4 W4 D void * client_data,! v9 }8 R0 t8 w0 i
UF_STYLER_item_value_type_p_t callback_data)
# v1 d' R, b$ _3 d6 Q$ O7 Z{+ H( ~6 g4 O5 e/ L, W5 ~, M
/* Make sure User Function is available. */
, G2 ]* N G3 N5 i5 Q if ( UF_initialize() != 0) / ?3 p+ s- Q! Q& b" b) |$ F: w7 A
return ( UF_UI_CB_CONTINUE_DIALOG );
6 `2 m6 u% x! z/ E
8 Z1 W/ x! v" r9 n0 v% w; n) n2 O3 { /* ---- Enter your callback code here ----- */
+ l/ V& f# `( R uc1601("您将退出对话框!",1);3 i, D5 \# P H. u9 n3 i2 [
UF_terminate ();5 z; W! Y5 G8 |! k
$ U8 q: b! k) B# m6 r /* Callback acknowledged, terminate dialog. */
3 J% x, e H E! z- S0 ` /* It is STRONGLY recommended that you exit your */
" ] F% i8 r3 e4 e0 E2 {4 v /* callback with UF_UI_CB_EXIT_DIALOG in a back call */; J) Q1 b3 M# ^
/* back rather than UF_UI_CB_CONTINUE_DIALOG. */: b v+ @! Q# J
return (UF_UI_CB_EXIT_DIALOG); 2 Q4 ]4 L+ Z* A5 ]! B6 Y
( g" X- Z/ u9 O" D. D6 `
$ L# d9 J' j/ N& L# x1 O6 M( y}
4 q1 l9 |" w+ ?# f- d$ N
, O, O5 Q8 \( S2 S( j" R! ^+ h/* -------------------------------------------------------------------------
8 k0 s; H7 Q( J- E& O7 W * Callback Name: DIALOG_ACCESS_button_cb8 ^+ z1 O4 w# l& c
* This is a callback function associated with an action taken from a
) V, Z- i2 I0 g& E" j4 b * UIStyler object.
- r3 i M; L0 s; J$ A *
4 g2 N6 q0 i' `! w L) ~& ]8 j * Input: dialog_id - The dialog id indicate which dialog this callback
2 g' R! I. x5 T7 u * is associated with. The dialog id is a dynamic,9 G* r' r& b) E" H0 `$ @
* unique id and should not be stored. It is
% ~$ r: |' q1 h$ Y' ?& x: _5 { * strictly for the use in the NX Open API:
& e3 K M6 Y/ a! R/ |1 v& z3 Y+ c * UF_STYLER_ask_value(s)
4 N: t& p0 ~' ]2 }& I * UF_STYLER_set_value 7 e- ?. x+ x) [- r( p/ n
* client_data - Client data is user defined data associated
: m) J6 h$ Z/ h6 z' k( n * with your dialog. Client data may be bound
) A' \4 j$ i& m7 K6 Y" J' p0 ` * to your dialog with UF_MB_add_styler_actions% }( X O6 F( p: b Q
* or UF_STYLER_create_dialog. % x. A: X0 g0 ]" s" y1 E
* callback_data - This structure pointer contains information
, A& i$ e& ?7 ?7 P1 a8 F4 A& G * specific to the UIStyler Object type that 0 D, A4 O* Q8 |7 k
* invoked this callback and the callback type.
* X9 p2 V: ]3 F/ s# Y * -----------------------------------------------------------------------*/3 @5 a( p8 B, [& w6 S: u! r
int DIALOG_ACCESS_button_cb ( int dialog_id,
' n# m5 q/ A [1 G, \ u! L4 o, m void * client_data,* }+ m' U' T2 V: J8 b# s
UF_STYLER_item_value_type_p_t callback_data)! G! I- i" h! A5 v1 z: {5 a
{
* p; s% S% t$ n7 R' g& f* o /* Make sure User Function is available. */
. g3 k8 z9 B( n( P2 E y9 M if ( UF_initialize() != 0)
( k6 n8 T+ M7 G return ( UF_UI_CB_CONTINUE_DIALOG );
: z0 r0 T. e8 B6 x# a7 R0 |: w
$ `2 m4 \" K: y+ Z4 T4 k! d /* ---- Enter your callback code here ----- *// T$ g# G8 d; v* w1 U0 J. {4 I% O
UF_STYLER_item_value_type_t data[3];8 X0 T* ?0 G5 m$ u
char info[100];
8 L6 x, u' N. g
1 T5 J o1 R3 k6 c2 {- g data[0].item_attr=UF_STYLER_VALUE;
$ Y; W+ |5 v9 w8 V i$ G1 C: c) B y7 ~ data[0].item_id=DIALOG_ACCESS_INTEGER;
' a) c- d3 n! d. W UF_STYLER_ask_value(dialog_id,&data[0]);) a1 e, o1 p8 s- e! `9 D& |1 \
+ o0 e, t) `- h3 Q9 x# q, V, A: b
data[1].item_attr=UF_STYLER_VALUE;. _$ q+ \, u& l1 ^* ]: G
data[1].item_id=DIALOG_ACCESS_REAL;9 u) p8 t( e4 X* S- E
UF_STYLER_ask_value(dialog_id,&data[1]);% _/ Q+ e5 N, w6 c0 ?5 i$ J6 v/ e
$ L8 h; A" J u* {$ P5 U data[2].item_attr=UF_STYLER_VALUE;) A: O* p% [7 X7 @0 ?, t! f# Y
data[2].item_id=DIALOG_ACCESS_STRING;' h+ d1 b! U1 m" U9 T
UF_STYLER_ask_value(dialog_id,&data[2]);0 U( Q: v7 v* ~8 J
2 T1 D# k" B) o& P sprintf(info,"整数为:%d\n实数为:%f\n字符串为:%s\n",data[0].value.integer,data[1].value.real,data[2].value.string);' Z/ i7 X& D+ p. {: \) V
; S- h3 \0 L: X$ b2 O
uc1601(info,1);: M0 b9 a6 n- x1 H. c
: z# l' F6 ^9 S. b
UF_terminate ();3 X" {! n" C* T- Q0 _8 S0 p/ B
8 |) H2 c7 q) ] /* Callback acknowledged, do not terminate dialog */5 k# O2 K" B5 m
return (UF_UI_CB_CONTINUE_DIALOG);
0 d5 n" j0 W5 |( |! j7 V
& k( _# W O: L7 J) ]$ ~& B /* or Callback acknowledged, terminate dialog. */
" X5 q, J' }, G& U /* return ( UF_UI_CB_EXIT_DIALOG ); *// {" s# V( ?: a& S5 z3 ~( e
}2 `8 X1 C; H+ {' k* m
: E3 @, z" c% H7 Q
|
|