|
刚刚进行vc++与ug nx 7.0二次开发 在编对话框访问时生成dll 但是使用nx open后调用dll 然后出现“缺少需要的库内存 功能ufusr”; }. ~9 W6 @. O% C" u" A
亟待解决啊 ! M4 \9 m3 N* p$ _" Q0 p9 o
附代码:1 U5 Y" z" m- B* H; x! i0 H
/* These include files are needed for the following template code. */
" t+ {4 b! A+ e2 v# e V#include <stdio.h> 5 h" r( Q! g8 w. w7 w( _3 v: t
#include <uf.h>
' H. _0 z& t. |0 O4 @* l#include <uf_defs.h>
! J; r0 M" c2 S: l#include <uf_exit.h>
* B* p* \9 Q3 }+ [#include <uf_ui.h>$ t8 }! o8 K5 u ?4 [
#include <uf_styler.h>
0 c: Q {6 [. n4 A#include <uf_mb.h>
9 {" o# h8 q- V2 s: O4 q#include "access_dialog.h"& j' Z5 f0 \% i @' o
, x" Q R5 ?: m5 t0 u9 n
/* The following definition defines the number of callback entries */4 {5 n! |" v9 i
/* in the callback structure: */
0 Q# d! o& a" ^$ C/* UF_STYLER_callback_info_t DIALOG_ACCESS_cbs */. I6 b! d3 ?& o a" Z6 t3 q( b$ e
#define DIALOG_ACCESS_CB_COUNT ( 2 + 1 ) /* Add 1 for the terminator */
, e4 P: U- @% ^, d
5 X" J% [9 o- P3 b/*--------------------------------------------------------------------------' J `0 Z" y2 v( h) b+ F+ j, v( |) O
The following structure defines the callback entries used by the ' m% f- E, p& @+ R
styler file. This structure MUST be passed into the user function,
j, P& ~0 S7 {! ^6 EUF_STYLER_create_dialog along with DIALOG_ACCESS_CB_COUNT. $ T# `& i" F# O: c3 ]3 D8 T3 a
--------------------------------------------------------------------------*/
& X% x9 e. g0 T9 \0 z, sstatic UF_STYLER_callback_info_t DIALOG_ACCESS_cbs[DIALOG_ACCESS_CB_COUNT] = 5 p4 E/ o% A$ ^- I: |$ F
{
* O% _0 f" w5 _ {UF_STYLER_DIALOG_INDEX, UF_STYLER_BACK_CB , 0, DIALOG_ACCESS_back_cb},* z+ N$ X7 P' X- C, W# G. `
{DIALOG_ACCESS_BUTTON , UF_STYLER_ACTIVATE_CB , 0, DIALOG_ACCESS_button_cb},) {! }, A8 k/ Y7 {: w& K
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }- d# m$ ]( F( Y6 w- x! Y) C9 a
};
! j4 U r6 ^/ h3 D6 a J# n; x& Y4 G
. |! ^. O R' w2 N- m
) k" D& @6 h2 y4 W1 }6 Y% @+ I2 z2 N! o6 u: }
/*--------------------------------------------------------------------------
& r: J/ f ~. R) {5 w4 e9 `0 ]UF_MB_styler_actions_t contains 4 fields. These are defined as follows:
$ r6 G) M/ ~% m- U! h* f/ t0 K# c0 Y1 X( t7 i
Field 1 : the name of your dialog that you wish to display.
5 X- K' a2 z$ @0 T4 @Field 2 : any client data you wish to pass to your callbacks.
- V; L' e% V6 q' q1 XField 3 : your callback structure.
* F, m7 ^, M0 u* a' DField 4 : flag to inform menubar of your dialog location. This flag MUST
$ V) G4 o' y9 E t% T) a% E match the resource set in your dialog! Do NOT ASSUME that changing # {2 @2 ]8 k/ o8 }7 r4 p
this field will update the location of your dialog. Please use the [* i* t2 z3 X; [
UIStyler to indicate the position of your dialog.
0 |; q c5 M* s) Y+ l--------------------------------------------------------------------------*/' C" ], l0 u* o$ f/ U
static UF_MB_styler_actions_t actions[] = {
" X$ [* z4 u: C: ~5 P' T3 I" F, H0 g { "access_dialog.dlg", NULL, DIALOG_ACCESS_cbs, UF_MB_STYLER_IS_NOT_TOP },
6 E; V% q9 k# r1 z' u) V& Q" P { NULL, NULL, NULL, 0 } /* This is a NULL terminated list */
! X4 d H6 F& J8 V* r8 H0 G};# ~( P& a4 y7 C
& I4 L" k9 J' t" f& ?# U$ P( t1 o
$ q7 O; E: \9 a5 X. B( O8 K8 F0 |
6 y! `9 g* I9 t% I8 e! x
9 z: s8 U; B; _$ M! X; x: v( l
+ I0 k1 f2 c) o. v2 _. w
5 b% f6 L6 [5 H- I6 h8 ~
T' T* J9 Q' E a/ t7 l
6 ]. ^5 e Z3 Z3 Y7 X/*---------------- MENUBAR HOOKUP HELP Example -------------------
0 h' b: G# N5 I' M T: W LTo launch this dialog from a Unigraphics menubar, you must follow
* Z1 D) p% u' R* m1 T) u2 X& N4 [: Othe steps below.
" V- L# G9 n7 {, p5 z! ~9 o1 ~1) Add the following lines to your MenuScript file in order to 9 P; h4 I3 P# ?( {6 ^
associate a menu bar button with your dialog. In this & E6 Z6 w0 B e, A, n% p$ B8 P
example, a cascade menu will be created and will be 7 Z* y; L* |/ o' n7 t4 }3 H0 g
located just before the Help button on the main menubar.
8 k* Y8 d! g5 ?+ ^' h% z { The button, ACCESS_DIALOG_BTN is set up to launch your dialog and
$ h4 W% j$ |, |' K/ E/ E+ a will be positioned as the first button on your pulldown menu. S; P7 X( h5 n" Z5 j% }
If you wish to add the button to an existing cascade, simply ! G3 P. {7 c( M) K
add the 3 lines between MENU LAUNCH_CASCADE and END_OF_MENU ' N x; f1 }" g. z
to your menuscript file. % c# F, L* J* f. b
7 ^: V& W+ V3 K' u* S The MenuScript file requires an extension of ".men".. N: }2 T* r8 R
Make sure that you add the extension to the file and place
3 v# p) I: c& g0 e/ H8 ~ the file in your startup directory:
A& P" X' S8 ]7 @( s+ ~ $UGII_USER_DIR/startup or
& M- K0 ~6 x0 k0 a $UGII_SITE_DIR/startup or ' v; M/ C; e, C+ x
$UGII_VENDOR_DIR/startup directory/ U; d: X4 l) B" G
G1 u, ?) |( I
% S+ K! a- ~: w. _' Z Move the contents between the dashed lines to your Menuscript file., Z. j7 a) i8 r1 Y7 U
! ----------------------------------------------------------------7 W& o' y5 K/ @; \% M* C7 ^
VERSION NX7
% l) b9 @% u7 p0 h4 H
1 I6 G/ t% r1 W, Y1 B8 a EDIT UG_GATEWAY_MAIN_MENUBAR/ [. J* K( k6 V5 [) e! V
5 [ Z3 E: a3 T% Z ? BEFORE UG_HELP4 A% [7 R) U" ^" @
CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN! H: S4 v$ r$ \8 Z) b. m* t
LABEL Dialog Launcher
" I" x7 E& p+ o! S END_OF_BEFORE- ~4 @# v, M p5 B+ }0 f# n: C6 b
0 c. b: h7 A7 J7 h9 o6 l- R8 C MENU UISTYLER_DLG_CASCADE_BTN
9 \: m4 t& T& W% }$ S7 d BUTTON ACCESS_DIALOG_BTN& X5 p. P- ~1 w% G. Z7 y% F+ C
LABEL Display access_dialog dialog
0 V8 U- k( ~) i# j ACTIONS access_dialog.dlg4 s: @8 ~& w+ F, @7 x
END_OF_MENU+ P: g) w/ x) r+ V$ i
! ---------------------------------------------------------------
) }9 f7 Y& `: V, f% J! R; l
4 A' }2 Q" Z' B) L
: `: z5 }& x0 h$ [- P2 I2) Issue a call to the function, UF_MB_add_styler_actions from the ufsta! }8 S8 ]' f- ]2 |
user exit as shown below. To use this call, remove the conditional % L+ A7 Q: O5 o# S0 Z0 t# w
definitions: #ifdef MENUBAR_COMMENTED_OUT " p* u5 g: b7 W/ y$ ] {
#endif MENUBAR_COMMENTED_OUT
W. A, x, o. A0 F, M
- C- n- P% w5 y0 _+ K# S/ @ V$ o The static structure, actions, will allow you to associate ALL of your; I4 P- \2 C$ @6 v4 \
dialogs and callback functions to the menubar at once. For example, if you
: E0 V8 S5 b0 B' z% R wish to have 10 dialogs associated to 10 different buttons on the menubar,0 H. N7 b2 F: p, ~7 E
you may enter each dialog and callback list into the actions structure. Make2 w- V+ l/ ?; }7 _9 B
sure that you have created a corresponding button in your MenuScript file.2 [( z( m* ?& b
2 x( s3 e+ Q5 U9 ]9 X5 ] You may also have separate shared libraries, each with a ufsta user exit
5 S! c* a" l; T* q9 y* F for each individual dialog.& J( P" `+ B! s3 s, J& }
9 l* m$ ~1 n1 A- q# q2 j
* M( ?& a( q' L3) Place your compiled and linked ufsta user function in 4 O$ l6 O& c$ w4 o: c
$UGII_USER_DIR/startup or ; N$ m0 U3 T9 e+ B4 q
$UGII_SITE_DIR/startup or
7 Z8 U; |8 l9 P- Q, P( | $UGII_VENDOR_DIR/startup directory.
. C1 Z1 g( K: q4 A9 j+ a5 e
' E6 u' N" c( N8 w4 x) _ NOTE: The user function must contain the proper extension .so, .sl or .dll ( n. A% `1 D, T$ M8 ?
to make ensure that it is recognized by the MenuScript. If it does not
$ t# @& r% F7 F have the proper extension, it will NOT be recognized by MenuScript. : y3 f0 x H q% h4 M7 r
) q! D( x1 ?" {& G2 X1 Z
' z, I/ y: z- R1 N The action name you have provided in your MenuScript must correspond to
7 a4 e# G: h3 Z7 L8 V9 I2 i+ U to the dialog name provided in the action structure. This MUST match inorder
6 S0 T7 J3 N0 {" B+ m to bind your dlg file to your MenuScript button. 5 b7 |0 S6 W, F0 u5 t
1 d+ W$ |! r$ q0 L8 t7 J
* a; G: s0 X2 D$ \( r- g" C5 P4) Copy your UIStyler dialog file to the proper directory.6 Y/ E2 y2 q# `; \
All dialog files (.dlg) must be located in 2 N8 P- c: o! P+ v
$UGII_USER_DIR/application or 9 D0 ~; T6 n2 @
$UGII_SITE_DIR/application or * |# j5 x, W8 r3 T! o5 N7 J
$UGII_VENDOR_DIR/application directory
; D; o. i8 ]: b) U+ A
$ n: {4 [" x& L1 b- u
% h4 b( b2 a c7 a% S& s# b. {! ^. U, R
. j; O% f: S f4 J4 K
------------------------------------------------------------*/
1 ?2 ]7 I& x! Q7 Y& i#ifdef MENUBAR_COMMENTED_OUT8 V: P1 { i9 u- q; `: i
extern void ufsta (char *param, int *retcode, int rlen)
: l! H& ^8 _% `% \+ N9 b3 d{" j8 v; u6 M3 v I0 \. ?2 n
int error_code;
4 _" Y' t" K; o' g" ^8 w, @( |
7 ~0 }" @- d- I: B0 c4 V if ( (UF_initialize()) != 0)
5 p! C& w( O0 {5 ? return;
% S% M8 J- X4 r4 t) v
2 n7 U; P! j0 V) ^0 v$ X if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )! e9 }- B: y @0 u5 @
{5 \6 N9 m) h7 H6 ]# V5 t) Z6 V' [
char fail_message[133];8 k0 K+ d+ \( U
2 p% q q2 v; y+ [ UF_get_fail_message(error_code, fail_message);
, o C* L' b. k8 m$ l* n' Y printf ( "%s\n", fail_message );
" `" l+ X5 {0 P$ A( E0 N }
9 S+ P! I+ u/ i0 j. M! p1 S8 Q0 [* m* y) y
UF_terminate();
* p$ f" |6 r" c- Y2 \$ J6 o& _ return;
/ M+ Z' u& E/ o4 l& w5 E9 o& p}- v) G8 ]7 x( @! `3 {7 H6 {
#endif/*MENUBAR_COMMENTED_OUT*/
( h# w P# v6 @9 }% K! N6 } n4 V# P3 n# b# z& b( u
; [( \. d! ^! r' t; }
9 O+ q# D2 F8 C: j/ _
* y9 Z/ x2 W% [
/ X5 q1 \# Q: G& m |( Y) s! Y, ~3 @2 r/*-------DIALOG CREATION FROM A CALLBACK HELP Example ----------
7 x; M, ?. h0 k- ]( ^7 l- Y) \If you wish to have this dialog displayed from the callback of
7 \# H. `) c! D1 i! H& Nanother UIStyler dialog, you should:
: B& x/ E3 l( G# N; H+ T6 B2 G! L
1) Make sure that the callback of your UIStyler dialog is
* A6 |; n$ u: ?/ Q# w" j7 U designated as a dialog building callback. + ^% i* R! p% P$ y6 d1 B
2) Remove the conditional definitions:
) L1 a3 b! O4 Q+ d+ y, G* `! i #ifdef DISPLAY_FROM_CALLBACK
! u) R- H) \6 u$ |$ R$ x #endif DISPLAY_FROM_CALLBACK
& t8 J' A% v! p; u$ \2 ?3) Your callback should issue a call to this function.1 s3 Q( u) [+ ~' |$ m {$ L
4) You should also add the funcitonal prototype to your header file
# R' _. u% @& j* P, s6 P8 i/ H* _ (access_dialog.h) and ensure that the file is properly included.
& I0 b0 l- B5 l" v) O* Z) S c# F3 x( V! C! h3 X2 A3 i& `
All dialog files must be located in
" |- s# m* V8 l $UGII_USER_DIR/application or ! o0 b( i3 q+ Q( j, z3 q6 c
$UGII_SITE_DIR/application or ! l. a7 P/ c% g' a/ j) L% ` K
$UGII_VENDOR_DIR/application directory
* L1 J0 |" d1 F2 W# M* F3 x--------------------------------------------------------------*/
7 _; I8 P* }" x, V3 Q/ Q# v y, L0 @" k; J2 e0 b, [ \
' d. j8 q5 K3 `3 n% C/ O9 W#ifdef DISPLAY_FROM_CALLBACK
! F( z! x6 g! `& W( g s, Mextern int <enter the name of your function> ( int *response )% E; W9 Q2 k1 x8 K/ S
{
6 H% [' G. r& T' ]* F, u+ h int error_code = 0;
+ ^. d8 ]8 y1 L2 b* R% G5 K5 R: c* P5 }/ j% L+ \- z. _
if ( ( error_code = UF_initialize() ) != 0 ) 6 A* @- f0 a6 k, G( ^& \8 N. g
return (0) ;% |4 u- S- r9 y+ V
b( \1 }+ w& T- o" E4 I& t# O8 m
if ( ( error_code = UF_STYLER_create_dialog ( "access_dialog.dlg",
* K0 o O! M8 n" ^, g% l DIALOG_ACCESS_cbs, /* Callbacks from dialog */ }3 F" `! o( y( s5 i2 b
DIALOG_ACCESS_CB_COUNT, /* number of callbacks*/ k& B$ k7 p" g! W9 Z
NULL, /* This is your client data */; {# c, f' b8 T, N( x: L
response ) ) != 0 ): u8 i; G0 l) L5 O
{& U# d& J: ]( v+ A7 V7 D" q1 V
char fail_message[133];
x# _$ o5 t G9 p0 V
. v1 t; v, _8 \7 {# N /* Get the user function fail message based on the fail code.*/* F# ] S% E' |3 k8 i
UF_get_fail_message(error_code, fail_message);
0 U- [/ {- H/ L UF_UI_set_status (fail_message);
& r! F! l9 x' K0 x/ k% J printf ( "%s\n", fail_message );
( F8 \2 A) T2 z7 L" k }" n" H' T0 F& T! e2 d F3 }
5 \$ p$ W+ N/ B% X# B4 a# D& H0 C
UF_terminate(); 8 d( a0 d, V1 i2 ?
return (error_code);$ ?& @( h: T. R
}" l4 j* C0 N0 C% D- A
#endif /* DISPLAY_FROM_CALLBACK */ 9 G7 W" H2 _9 h
6 P% o3 e4 p5 l, x+ t6 x8 B
+ R' S% G1 P+ z0 v% b! H! b) A" ?4 U; a% | j5 x! q% v8 j$ y- o$ }
) P1 D5 ^$ |5 Q4 k, {* d: x$ c* e
/*-------DIALOG CREATION FROM A USER EXIT HELP Example --------" ^9 m" e8 g$ H0 p! S( F! E
To create this dialog from a user exit, you must invoke a
( `6 W, E3 O# b# w5 q7 ?call to the NX Open API, UF_STYLER_create_dialog. An example
; ]$ j1 l6 I; O l# Fis shown below.
, c( j6 r" p) H
5 i" D1 E' Y5 U7 A. VAll dialog files must be located in 4 f6 s8 @+ K! \" w y# B/ r
$UGII_USER_DIR/application or
8 G% A& f0 f. O1 | $UGII_SITE_DIR/application or
9 Z; S( p, R" `. Z4 R& \, w; \- h $UGII_VENDOR_DIR/application directory
8 K" T6 ~2 U% ]$ o6 Y
; n+ X% _$ n# u# e& l1) Remove the conditional definitions:
3 n- o" K v% X9 \9 r( D3 R3 ]0 I #ifdef DISPLAY_FROM_USER_EXIT
5 s7 n! e2 A# F- T #endif DISPLAY_FROM_USER_EXIT 6 F) u& M1 C/ I# Y$ U! S: v* Y
2) Add a user exit to the function name below, for example, ufusr.5 a5 j4 z5 A4 c: [& [/ ~
3) Consider how your shared library will be unloaded. Take a look
: l5 p f" A" u+ ?4 D- D at the generated function ufusr_ask_unload.
# t F6 }5 ^* H--------------------------------------------------------------*/
5 Z- t+ a5 A: g. X5 I6 [
/ N$ g: t* k: n$ `% O5 B: m#ifdef DISPLAY_FROM_USER_EXIT! M2 N' ^1 q G& j
extern void ufusr (char *param, int *retcode, int rlen)- y2 V! {. ^3 [1 f
{
8 ^' ?) j* F" I9 U! Q* _ int response = 0;* Y% e& ?8 @1 W' E
int error_code = 0;% `3 t- y0 p. K _
, A3 } n& C% e# v! u& R; |
if ( ( UF_initialize() ) != 0 ) ! a5 S) k' } Y7 K/ f3 |
return;
" q* Z- o; F' e& U, \' z" M1 |1 q
if ( ( error_code = UF_STYLER_create_dialog ( "access_dialog.dlg",
& j8 p5 ]1 d( B9 H8 F" I DIALOG_ACCESS_cbs, /* Callbacks from dialog */, j- N; n! H: Q5 ]; Q3 j# O
DIALOG_ACCESS_CB_COUNT, /* number of callbacks*/
+ m$ F- x+ S' |9 s8 Q6 h NULL, /* This is your client data */
0 O6 }2 [: A: } &response ) ) != 0 )
( X; Y4 m6 K! T8 S/ t4 K g( v {
* o4 S9 s P2 j3 P char fail_message[133];
- p8 L% \$ P1 I7 s# b! f7 M% z* p7 q/ r7 X$ C! D5 e; d+ E
/* Get the user function fail message based on the fail code.*/% h# }& x" n% |$ N
UF_get_fail_message(error_code, fail_message);
# y2 N+ i0 b$ a: [ UF_UI_set_status (fail_message);, E) F4 O; L# i+ S* Y+ k5 p, \
printf ( "%s\n", fail_message );
6 A+ v9 z( d) y" i& q7 ` }8 F% L B$ L* b, `6 U9 f
8 G9 p. V @( A+ ?- Q, \/ y7 N& Y* x, s; ~5 a
UF_terminate();
' T4 |, l1 R4 W. L return;7 c1 Z8 D8 U7 |2 P& [' N/ D* p
}
/ z( G9 `" \! U8 w- o; F
' B) S% r7 I& Y% F2 D3 G# o0 H' t0 y% v
9 i% y0 e1 L& [; N3 e! a
" D" ^: \' g7 w/*--------------------------------------------------------------------------5 N; ?" V8 e$ X% L+ U" v! S
This function specifies how a shared image is unloaded from memory
* i& y; ]% d! q9 jwithin Unigraphics. This function gives you the capability to unload an
8 y. h* n% @+ \! I( [, e' vinternal NX Open application or user exit from Unigraphics. You can
* U' F) a; T: O/ v) Gspecify any one of the three constants as a return value to determine
" w/ ~ S9 y, n0 X, Zthe type of unload to perform: immediately after user function 9 A. q5 w2 H4 O4 y& S* H" z
execution, via an unload selection dialog, or when Unigraphics terminates
h' D* z1 [, P' v- nterminates. If you choose UF_UNLOAD_SEL_DIALOG, then you have the " ^% d8 t" r$ U$ n% T. {6 q2 e; p( W
option to unload your image by selecting File->Utilities->Unload Shared
9 W* |% f8 M6 Y/ v( xImage. 4 T5 `! h% j3 ^5 T# b6 z& N
& M/ g7 K8 H+ K. j9 {NOTE: A program which associates NX Open applications with the menubar # X" q* w, J! u( c" p; W" @* M
MUST NOT use this option since it will UNLOAD your NX Open application image
, b2 |9 M3 s9 S s5 M' D; J--------
& X% Y* l4 X1 q& e/ Ufrom the menubar.3 c3 S5 J1 |' [* g
--------------------------------------------------------------------------*/
0 V% H1 H- x" q+ L q0 u; Q4 V$ |* @* i! o7 _0 |* W9 L. _# @& c
extern int ufusr_ask_unload (void)
0 e# a8 s" T9 t- A; t; L' G{4 B" x3 M/ ?7 h! b
/* unload immediately after application exits*/
6 m* u, Z( h) L* f; o, z! T4 S return ( UF_UNLOAD_IMMEDIATELY );
- i" X P3 c8 Z7 W. E
h2 ]. t$ i% U; I3 e' @1 N! j /*via the unload selection dialog... */
+ D7 h6 O v- N3 ^" _1 O! |, {! p0 c /*return ( UF_UNLOAD_SEL_DIALOG ); */
0 @/ \# s7 t7 h( h0 | /*when UG terminates... */
2 ^# E+ c. \- T: Q3 a6 x0 h$ s /*return ( UF_UNLOAD_UG_TERMINATE ); */
6 F% L3 j3 D! Z; w}
. `, u6 K, y% l/ J5 Y+ {7 Q4 ?# I
2 ?1 e) x$ T1 `5 Z! H4 K9 A0 `6 a! X/ ?0 Z6 U, C
2 Y: H5 I4 y' d: i
/*--------------------------------------------------------------------------2 m1 y% q% |: [
You have the option of coding the cleanup routine to perform any housekeeping
; j5 x7 g" L2 [chores that may need to be performed. If you code the cleanup routine, it is$ G h! K8 U" V- b2 O- G1 _6 n
automatically called by Unigraphics.7 J# h1 D. h3 o5 l: S' N
--------------------------------------------------------------------------*/6 Z+ S. o- h3 M' d+ c3 m
extern void ufusr_cleanup (void)
! d% x6 `$ T- \{" o: Y5 x$ o/ w3 _4 v# s+ E
return;. c" ?0 S' N9 ?8 |) w
}
1 ^0 `% l/ D: f$ w0 l$ X/ o1 M//#endif /* DISPLAY_FROM_USER_EXIT */ ) g* x9 v8 q8 i' m7 U0 Y
' l' O! i$ S `2 C2 D' K7 e1 j5 H8 N
9 C9 W) x) G! Z# H5 U5 I$ _
7 K# J+ \6 x: g) h R+ @ l; V% }2 E& r
) _9 I4 D% H/ n) y/*-------------------------------------------------------------------------*/
3 \0 [1 ~/ [6 s9 u. {/*---------------------- UIStyler Callback Functions ----------------------*/( u0 L' l* {# ^: Q
/*-------------------------------------------------------------------------*/$ B5 r; n& j* o. i% V& l
0 g6 d/ ~3 f) _" {+ n4 b
/* -------------------------------------------------------------------------7 n" W0 @- Y: G/ P I
* Callback Name: DIALOG_ACCESS_back_cb
# C1 i1 H- y8 t4 O * This is a callback function associated with an action taken from a
a! Y) g/ Y% K u$ F- K * UIStyler object.
9 k8 O" j( i5 p: K *7 l; U8 I z0 y
* Input: dialog_id - The dialog id indicate which dialog this callback% L9 h& z4 o$ I* M2 s& A( H
* is associated with. The dialog id is a dynamic, J& w( ?( S q5 |/ y
* unique id and should not be stored. It is2 D- F5 q/ ]$ `! Z9 Y4 ?9 T7 l
* strictly for the use in the NX Open API:. t1 p3 h% }2 ?6 i$ G3 f0 ]
* UF_STYLER_ask_value(s)
# U$ d. \+ [0 \& Q& X * UF_STYLER_set_value
1 n& k, _8 L, \/ ]3 D' b * client_data - Client data is user defined data associated1 k- l; n5 h+ B3 _! K% d, O
* with your dialog. Client data may be bound, X; z3 Q) Q6 E2 l! Q
* to your dialog with UF_MB_add_styler_actions
9 A! J( F. I, d8 [ * or UF_STYLER_create_dialog.
/ ~; G$ n6 ? A! ^, v) N" L * callback_data - This structure pointer contains information
! \6 Z' H# }2 K * specific to the UIStyler Object type that L$ d5 c6 V& ^5 _
* invoked this callback and the callback type.. d- V+ P( K# q! R4 y5 x1 G6 J1 {
* -----------------------------------------------------------------------*/* L+ m) T' m, B: J
int DIALOG_ACCESS_back_cb ( int dialog_id,5 g- F. x( r- G
void * client_data,
( u& { C# w2 z UF_STYLER_item_value_type_p_t callback_data)
- J1 F4 _/ h" b0 V4 h/ J+ U" `" q{0 M& o( C3 F2 W9 j) v
/* Make sure User Function is available. */ / j/ F+ L* m# R* a" W6 U+ l
if ( UF_initialize() != 0)
5 w. f8 ~8 _+ N2 I, E" e1 U7 W! {' j4 ] return ( UF_UI_CB_CONTINUE_DIALOG );- N% u: X4 j1 z. x" w! J2 v l
# e0 @& m0 ~) `
/* ---- Enter your callback code here ----- */
1 T+ \1 g. z" `, | uc1601("您将退出对话框!",1);8 `. n# K, E @: P6 M; m) b' l
UF_terminate ();0 [) z4 g# K1 T/ S& C
& ~6 M C2 Y/ a; z- U8 h3 j( q8 _
/* Callback acknowledged, terminate dialog. */
8 j# C! F0 A% v4 P* N /* It is STRONGLY recommended that you exit your */
# c" b6 ^$ `7 i /* callback with UF_UI_CB_EXIT_DIALOG in a back call */9 d/ u0 C9 x' R% W- O+ H+ Z
/* back rather than UF_UI_CB_CONTINUE_DIALOG. */
! h) P. Q) a- S8 O3 _' y return (UF_UI_CB_EXIT_DIALOG);
+ P% i5 h. N$ b v+ [/ p6 L' l% [) ?9 ^. q$ R9 Z" u
{' _! d5 q4 y
}, j3 I# o/ d2 {: I
) h; p, I4 F! ~9 v# k, D: a1 y
/* -------------------------------------------------------------------------
' l6 M. X r( l8 M" i& M * Callback Name: DIALOG_ACCESS_button_cb
) e) @& Z* g* H: C8 i4 N7 k * This is a callback function associated with an action taken from a
8 L0 x d8 K7 D! l T * UIStyler object. 3 R) ]3 q* Q* N( P
*
5 q6 k8 ?) E8 T/ I * Input: dialog_id - The dialog id indicate which dialog this callback
& y" {5 o0 R0 W* W' G/ \ * is associated with. The dialog id is a dynamic, r1 W; U7 b% s+ h
* unique id and should not be stored. It is4 B+ s j! E3 R$ y
* strictly for the use in the NX Open API:; q/ t6 j" t1 D5 [
* UF_STYLER_ask_value(s)
- f/ I e: y, E2 l * UF_STYLER_set_value ! m" I! v) V% v3 h0 h' R; l, e
* client_data - Client data is user defined data associated: O# R/ v2 J; k6 j' H. ?7 S
* with your dialog. Client data may be bound/ A: z9 }+ q' u2 W8 N
* to your dialog with UF_MB_add_styler_actions
0 J, b0 E4 }+ Z8 M) c) F4 s5 W * or UF_STYLER_create_dialog.
8 z$ L0 t2 e/ ?: h# P/ u * callback_data - This structure pointer contains information
6 b! B3 Q" o4 p * specific to the UIStyler Object type that - J8 j0 f+ c* R$ n- p
* invoked this callback and the callback type.
2 i% r4 W) l% f- ]& ] * -----------------------------------------------------------------------*/
3 a+ Q+ e$ |/ _" _) k4 {3 }, m; kint DIALOG_ACCESS_button_cb ( int dialog_id,
+ Y" ^$ c* |7 m$ E& n3 F4 g; k void * client_data," L! R4 {' g$ p1 h; B7 Z5 M
UF_STYLER_item_value_type_p_t callback_data)
" y4 C( ?0 \* h& x) S7 ]" L2 l: R2 M{
* `, N- U1 T: Z$ } /* Make sure User Function is available. */
6 M4 ~' ~% L0 `" w. Y4 }4 M: C7 W% ~ if ( UF_initialize() != 0)
0 M3 Z f! A0 I- Z! |+ {$ e3 Y K/ L return ( UF_UI_CB_CONTINUE_DIALOG );
v) k8 Z, }0 d" T5 f. |& y; ^
2 q5 M* k( f% i. k% c$ V, A( B0 v /* ---- Enter your callback code here ----- */
9 q, Y3 J, \3 E% a6 P4 w UF_STYLER_item_value_type_t data[3];) i- s) s J: t" R; C) g
char info[100];
9 i. r& M1 D* ~8 {. l- H0 J
. g% ?( w9 ]# c& {! `6 ^ data[0].item_attr=UF_STYLER_VALUE;7 v$ U* Y8 I. N9 P
data[0].item_id=DIALOG_ACCESS_INTEGER;
' `$ r( Q: {( f+ N' b5 n1 y0 a UF_STYLER_ask_value(dialog_id,&data[0]);
! u/ K2 q( N& s. U# W" W2 ]: d1 E" J0 F# x
data[1].item_attr=UF_STYLER_VALUE; c' m/ O! }. j
data[1].item_id=DIALOG_ACCESS_REAL;
$ O# l% L1 s7 d2 Q! B: n UF_STYLER_ask_value(dialog_id,&data[1]);7 D4 q( V" @3 ~: f& ]% @
?9 m# Q# Y4 O ~0 ^: j' { data[2].item_attr=UF_STYLER_VALUE;% A" I, ]' |' m0 ^! z
data[2].item_id=DIALOG_ACCESS_STRING;5 |, R! c5 v' S+ R/ q
UF_STYLER_ask_value(dialog_id,&data[2]);% Y+ u% ` J% B8 g9 s
6 F) e4 c7 |3 ^8 u0 _' x
sprintf(info,"整数为:%d\n实数为:%f\n字符串为:%s\n",data[0].value.integer,data[1].value.real,data[2].value.string);+ `& [: ~) _+ @, |+ r9 [ N
; `0 b& h. y( N( I: Q6 N
uc1601(info,1);
- X9 r/ |- X7 {) Y& k; _( h2 e7 M' o% s6 s* ^
UF_terminate ();- Y: L# R& B% O5 M2 R" `
9 e! Y G! I* c4 W* w1 G7 H /* Callback acknowledged, do not terminate dialog */% j4 w' H$ \, \# W# B
return (UF_UI_CB_CONTINUE_DIALOG); " n, R: t* X' J: O+ I( D) T+ s
; k4 z" U3 u" v! D, V o. ] /* or Callback acknowledged, terminate dialog. */
3 o4 ], R, S( c# M /* return ( UF_UI_CB_EXIT_DIALOG ); */
4 _# V3 J- A0 {% I* l* |' L}
6 |$ e: c- y: n# h: p/ P
]& V1 T6 n% T/ i) U" v |
|