|
刚刚进行vc++与ug nx 7.0二次开发 在编对话框访问时生成dll 但是使用nx open后调用dll 然后出现“缺少需要的库内存 功能ufusr”4 h6 R, G$ _$ y, u, `
亟待解决啊 / z0 E+ M3 A: V# ~( O5 M* }
附代码:% X7 B N4 @* d5 p
/* These include files are needed for the following template code. */
" D3 m6 N- L( Q( l6 z! d#include <stdio.h> 7 _: w4 l# H; M% s5 R
#include <uf.h>
& M* ^+ I6 P) S4 ]#include <uf_defs.h>% p1 r& l5 L9 T; y) g! y/ a) D6 Q
#include <uf_exit.h>+ q3 P- F- m% k d( l8 `% ]
#include <uf_ui.h>
8 [" C% O3 d% M7 G' D1 z g#include <uf_styler.h>
- u R1 a# g8 ^( Q: W#include <uf_mb.h>
7 L/ j5 x8 L# s: r, E- u/ h2 I! }#include "access_dialog.h"' H" ~; [# y: {
' ^$ [. Z7 `+ f" }! O9 H
/* The following definition defines the number of callback entries */
' b/ ~8 k( H; G- p/* in the callback structure: */
8 o8 [6 d* x4 Y9 t+ Y; j% y9 S/* UF_STYLER_callback_info_t DIALOG_ACCESS_cbs */
2 r0 Z( z: [/ @ G, e#define DIALOG_ACCESS_CB_COUNT ( 2 + 1 ) /* Add 1 for the terminator */) r* D+ M _' g! P5 t( b- @$ ~6 l
9 Y6 f& ]4 C+ R' u1 g7 L/ ]5 v/*--------------------------------------------------------------------------+ }8 L F7 L+ U: @$ \ C
The following structure defines the callback entries used by the $ m1 |! L( B: m( q' V% W' e# g8 ~
styler file. This structure MUST be passed into the user function,
9 ?: e" L( k: g( \( YUF_STYLER_create_dialog along with DIALOG_ACCESS_CB_COUNT. $ z& U. V. m+ l- g" u6 g5 y+ D$ `3 Y
--------------------------------------------------------------------------*/* o; q+ S3 F* R, x
static UF_STYLER_callback_info_t DIALOG_ACCESS_cbs[DIALOG_ACCESS_CB_COUNT] =
7 w0 B( b1 t# x+ ]+ Y{7 M: `% G( [2 y3 i% {7 |
{UF_STYLER_DIALOG_INDEX, UF_STYLER_BACK_CB , 0, DIALOG_ACCESS_back_cb},
* d5 U) `5 H, x: Y% F! d7 n! c {DIALOG_ACCESS_BUTTON , UF_STYLER_ACTIVATE_CB , 0, DIALOG_ACCESS_button_cb},* J: Q7 v) r" a* C/ V9 u. e
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }+ h6 w1 j& h% F, H
};
2 _: ]. ~8 ^& J5 X6 R8 \0 @& Z! ^7 U* H2 q* Y; k2 ^2 F$ G
4 D, L9 }* N3 O/ Y$ _
/ F0 O+ B( D) q9 d
/*--------------------------------------------------------------------------
3 C- \# \# m3 {. O5 B, ~UF_MB_styler_actions_t contains 4 fields. These are defined as follows:: f. q' J! q% b
# ]6 Y* S* X' Q/ w+ x0 F! ?" jField 1 : the name of your dialog that you wish to display.- O$ G- Y+ K9 d. }$ Q
Field 2 : any client data you wish to pass to your callbacks.3 P2 [$ |) X5 Q% n8 S1 ^
Field 3 : your callback structure.+ d' I- t; j$ j2 x" N/ V+ y
Field 4 : flag to inform menubar of your dialog location. This flag MUST
% w; \5 k* x% N! o match the resource set in your dialog! Do NOT ASSUME that changing ; T* @; A* z% t5 H2 @; e; e9 B
this field will update the location of your dialog. Please use the 0 H! w0 t( [( T9 S; p; {+ a8 X
UIStyler to indicate the position of your dialog.
6 I3 V: I9 l. ~: ~, C- [9 H--------------------------------------------------------------------------*/' S7 C/ N+ F: r. q) e- U7 Q# x8 b
static UF_MB_styler_actions_t actions[] = {
" A! J7 _6 ~0 Y9 Q { "access_dialog.dlg", NULL, DIALOG_ACCESS_cbs, UF_MB_STYLER_IS_NOT_TOP },
% k$ y- N- l6 j( s+ k { NULL, NULL, NULL, 0 } /* This is a NULL terminated list */1 P6 }( ^) E) F: p' e1 S- Y/ J8 V
};
- J C$ [/ u8 C3 [% p0 n
5 S3 p2 m" e( h& `$ r9 k3 W2 @$ Z
& Y) B) y% a {" o5 Z, ?4 X, @
/ q9 F8 l( N2 z9 r. |0 K! G, }
* A* h! J2 K0 G6 E
2 }% o0 d. N& j2 k' Q) y4 w
3 P+ e1 Q/ \7 l
+ ^5 D x- t% u4 W4 D/*---------------- MENUBAR HOOKUP HELP Example -------------------8 h5 E' G, c/ k- t8 N% F
To launch this dialog from a Unigraphics menubar, you must follow
- ?$ N w8 R2 }the steps below.3 |( z8 d0 P- U1 x- v7 ^
1) Add the following lines to your MenuScript file in order to
% E6 S9 x- K# {5 z associate a menu bar button with your dialog. In this
' v7 r. K1 ^& m @ example, a cascade menu will be created and will be + w. l7 b' B' p; M7 c+ i- h+ [
located just before the Help button on the main menubar.
( R' K( h) F# I8 U& L The button, ACCESS_DIALOG_BTN is set up to launch your dialog and
- |* j4 p% ~4 {' \2 f will be positioned as the first button on your pulldown menu.
% \1 R) j/ o* K If you wish to add the button to an existing cascade, simply {( B" k1 t- i/ ]
add the 3 lines between MENU LAUNCH_CASCADE and END_OF_MENU 4 L; O, l0 l! G6 T2 x" D9 N
to your menuscript file. 5 i/ ^/ `2 I k* D8 a% w
8 ~5 F; v/ U, @0 D+ a( D+ o) X' Q
The MenuScript file requires an extension of ".men".3 Q! W& f% u# N0 p8 v6 u
Make sure that you add the extension to the file and place
$ [! b1 |/ C8 v9 Z the file in your startup directory:2 ]8 N) h4 |5 A N, D$ Z
$UGII_USER_DIR/startup or : Q& F u8 M5 _% J2 l& b5 b' h% u# Z
$UGII_SITE_DIR/startup or 2 X8 Y% t7 P# F
$UGII_VENDOR_DIR/startup directory
- x, t3 B F- w+ _" V
6 M* |/ q$ D: L8 Q* L; A
2 N& d' r1 E. ~7 u4 B0 u- ?: x# } Move the contents between the dashed lines to your Menuscript file.; Q# @3 \0 n6 j2 G) i9 ?
! ----------------------------------------------------------------
# Y* h) T6 `3 j- f VERSION NX7" E8 C) _. w- v! q6 f% ]( m
/ a, ~1 h; }% J- c7 o
EDIT UG_GATEWAY_MAIN_MENUBAR# B4 Y; i2 k! v5 L0 [) {; U
& G% \* M7 u/ s/ Z" `5 O4 b
BEFORE UG_HELP
) Y# x/ A- |3 p. q9 c2 G8 x CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN% w7 { l: G( q5 p9 o4 w! h
LABEL Dialog Launcher1 u q2 d1 {% }( U4 i
END_OF_BEFORE
+ C" z, R% P" o7 f6 P, E9 d9 e0 z# x. U6 T4 }) _( b2 g
MENU UISTYLER_DLG_CASCADE_BTN
2 S% w5 n: Y' s- B9 f$ I4 F! @% _9 E BUTTON ACCESS_DIALOG_BTN5 h* h+ z5 ]5 H J( ^; {# F
LABEL Display access_dialog dialog( j. D' v& [. J# S9 a. d
ACTIONS access_dialog.dlg- g' A. L% b/ _* e* B/ N" q
END_OF_MENU, ~* C- z8 F3 X4 n* w
! ---------------------------------------------------------------
9 R$ G3 ?2 M! _( z
! w& f% I A9 C9 I T" q, w& k5 j8 `' T1 d9 J6 \5 N; c
2) Issue a call to the function, UF_MB_add_styler_actions from the ufsta, P; }9 G; d8 I: p9 Q8 D
user exit as shown below. To use this call, remove the conditional
8 h4 J! j; j0 x$ S definitions: #ifdef MENUBAR_COMMENTED_OUT
& e W( s9 ~0 q5 O' ?4 r! ~7 U7 C: c #endif MENUBAR_COMMENTED_OUT + j' B$ T3 Q* S! Y2 o8 H
+ V5 S# J4 J% u; d* Y The static structure, actions, will allow you to associate ALL of your- x! D+ C) V$ X
dialogs and callback functions to the menubar at once. For example, if you ( B# f3 F+ t: d( t0 E' T" o
wish to have 10 dialogs associated to 10 different buttons on the menubar,
% n! T, ^$ ^9 D7 @ you may enter each dialog and callback list into the actions structure. Make
7 j( F0 _3 t3 C) g1 G sure that you have created a corresponding button in your MenuScript file.( K0 {4 l) v7 q5 \" \
# X% b h8 |9 H' B! _# P! |- E You may also have separate shared libraries, each with a ufsta user exit
0 e' j$ M9 ^" M8 A* S for each individual dialog.0 Q2 `, {$ W5 A
0 k3 M, g0 b4 X
" u4 U- M) k0 `! z: |3) Place your compiled and linked ufsta user function in
" K% [1 G6 ]# i3 u, Q9 G# r+ x $UGII_USER_DIR/startup or ! m. R+ i; B; d3 u
$UGII_SITE_DIR/startup or - X. i& k7 Z- G7 d" U% I
$UGII_VENDOR_DIR/startup directory.
1 |4 z& ^6 C+ F
: Y* H8 v$ B1 k$ o! X NOTE: The user function must contain the proper extension .so, .sl or .dll 8 j: X7 f' {/ a$ s, o
to make ensure that it is recognized by the MenuScript. If it does not
Z3 p: C0 P7 C8 U have the proper extension, it will NOT be recognized by MenuScript. & p% T- r4 ]9 ^9 a2 b* L( O, L
% {+ f1 N7 z+ \0 |2 g3 [5 r: A. d( A @8 W: i, X/ ]
The action name you have provided in your MenuScript must correspond to
8 n+ T; Z/ x7 o7 x to the dialog name provided in the action structure. This MUST match inorder
2 a" {/ P! H$ o to bind your dlg file to your MenuScript button.
6 k5 f, f, Z0 P, V+ G4 G" l
3 ?, \* R) g) j# x; ^" `
- L5 {* t1 C5 }( m) y: t4) Copy your UIStyler dialog file to the proper directory.1 R: H6 u* v9 U8 v1 M# L# C, B
All dialog files (.dlg) must be located in 0 Y$ t& t9 h' m2 Y& L6 o
$UGII_USER_DIR/application or
7 @" g1 T9 \5 D1 ~ $UGII_SITE_DIR/application or 7 ~6 P1 I$ b& A, P; Q i0 Y/ C
$UGII_VENDOR_DIR/application directory. F8 H! m# V# S) l, m
+ N6 B. l9 T: M3 `0 t" ~6 a- A) Q* Z% b$ O
H1 f. T' \1 t7 i/ y2 O) ^# E. e! j& j2 @4 q
------------------------------------------------------------*/
3 m6 ]2 r/ D Z$ s* M! h: f#ifdef MENUBAR_COMMENTED_OUT* ~8 N8 w1 ]5 u, R
extern void ufsta (char *param, int *retcode, int rlen)( g7 b- Z8 v e4 j1 V
{
t+ B1 c0 a+ r$ }& W0 A2 c int error_code;. h2 p2 k* P+ ^0 O# w' t
0 C$ l) U7 E7 |. u3 p$ {8 x4 x if ( (UF_initialize()) != 0)
- { _: N! n3 j5 _. d return;
' g& g! N$ S2 _- k6 e* K M# U* f4 O: ~, Z
if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )
1 Q: E$ U; R* Q' E$ @5 D {
; j- H9 a& J# V char fail_message[133];
3 B* j, l8 M& @' }! \, h+ E$ C# s1 N- E
UF_get_fail_message(error_code, fail_message);/ c/ u0 y) h: c4 ^* t: `
printf ( "%s\n", fail_message );
+ ]% y. l9 s% i1 ?" r# N0 {7 t }
1 B5 I( I- ~7 g/ @
$ ]* F8 D' m0 [3 u+ W7 J7 U UF_terminate(); % e* Z2 T z6 F
return;
+ n) O2 I9 X- N1 @3 t3 ?7 [}
: r+ Y0 B6 Y$ d1 u$ \ #endif/*MENUBAR_COMMENTED_OUT*/# H; Y N; a% b6 Q5 V
* t: z) ?6 _, F1 [! X& j! c) v& z: t# F2 x0 M/ M
G% k& \0 }& N. v2 `/ Q4 W
' `3 ^; v& {- l( b
: U9 x B; [8 T ^# K1 u/*-------DIALOG CREATION FROM A CALLBACK HELP Example ----------& Y, d9 q# @2 Y9 B! W
If you wish to have this dialog displayed from the callback of 5 a, Q7 N. |8 O5 {3 h, d; h/ b
another UIStyler dialog, you should:
( z, ~5 p4 F6 `9 ?' t& \
" m$ L: s/ G9 _% |% a1) Make sure that the callback of your UIStyler dialog is & Z* }% s# Q$ q j; R( n
designated as a dialog building callback.
* H @/ ~3 x% P) c' l) q9 r9 q7 T% I2) Remove the conditional definitions: R% p) L4 p6 C Z( ]9 l3 `
#ifdef DISPLAY_FROM_CALLBACK
, }% e. |( f7 e' y [( h/ j' C6 m3 ~/ ~ #endif DISPLAY_FROM_CALLBACK
3 G" ~" Y+ F" ]2 Z8 _3) Your callback should issue a call to this function.' r+ _* q; M- @9 K0 w% N& n
4) You should also add the funcitonal prototype to your header file ( b- f* o. U L8 G
(access_dialog.h) and ensure that the file is properly included.0 l: A$ V: ]; b g# @4 n- c- d& @
7 w4 p- V% A s: Z1 I' Q0 R/ QAll dialog files must be located in
: |0 r6 `+ o3 L& e! K $UGII_USER_DIR/application or
5 B* k0 f) X3 \' Q4 a( N $UGII_SITE_DIR/application or 2 z) S8 a0 S0 i: h- y
$UGII_VENDOR_DIR/application directory% d4 z$ x- L4 }; G% _" p7 e
--------------------------------------------------------------*/7 e" l: P: q/ q
! u3 ]5 }& p) a
* Q0 u' s, l3 M1 N( I" }#ifdef DISPLAY_FROM_CALLBACK
1 ?$ Q# c9 H; v6 N5 |8 pextern int <enter the name of your function> ( int *response ); E! K* }" ~8 l, m
{
+ \4 N7 k! w, B3 O int error_code = 0;
- A' c/ ]! c$ f r
% h; {9 `" D- H7 e* L if ( ( error_code = UF_initialize() ) != 0 ) 8 o6 m9 x; F+ q- z/ C
return (0) ;
0 R) i0 c" C( }( k+ h R
! v' L! |7 R8 S% N$ ~; t! G( N, r" \1 R if ( ( error_code = UF_STYLER_create_dialog ( "access_dialog.dlg",* ^: ?& J9 t; x; I+ t
DIALOG_ACCESS_cbs, /* Callbacks from dialog */, Y9 n, x) }* E: ?3 G) B' i3 [
DIALOG_ACCESS_CB_COUNT, /* number of callbacks*/
* @7 T8 m6 B1 J4 b/ L6 U6 ~: h NULL, /* This is your client data */
" T- l, D, O1 w4 o response ) ) != 0 )$ @1 c) m6 W2 i* s, z9 E7 m e
{
8 M% Y/ T; g, q! Z2 v* a5 I5 d char fail_message[133];
+ j+ J* }0 E2 j
: D$ P) W8 o" B+ w4 V /* Get the user function fail message based on the fail code.*/
* ]+ @6 }8 ^7 ? UF_get_fail_message(error_code, fail_message);
) B2 P8 p" ?) S+ j UF_UI_set_status (fail_message);
% M7 E) n# R0 l printf ( "%s\n", fail_message ); $ Q! P% C* e. w
}
* u Q: n! h3 P# B1 F" A( U/ M- T- V% Q9 x0 D
5 A& h* A/ B+ R I2 C
UF_terminate(); / j2 a& T! Q7 g/ \
return (error_code);$ ?/ q) A+ W% C$ {' ^
}
; o% ~* {% O6 Q' ^# a#endif /* DISPLAY_FROM_CALLBACK */
! o5 {: U4 ~6 i- {) `/ {* |
( G4 z1 d2 x0 Q6 C: }
" @/ V9 I& ?: i1 {
3 Y7 f5 E1 J. r$ l P' u# P! |7 l& x- A$ _- }7 v9 }
/*-------DIALOG CREATION FROM A USER EXIT HELP Example --------
( q! x0 X: N: L' xTo create this dialog from a user exit, you must invoke a 1 {5 Q9 e7 v4 B* C5 Y" \0 c
call to the NX Open API, UF_STYLER_create_dialog. An example 6 v5 i1 a) x0 E3 S/ i
is shown below. 3 U; [8 C$ r) E. {- n+ x
3 {6 q9 E( p* H% v: x
All dialog files must be located in ' h- N; I; B5 {- O% \. X
$UGII_USER_DIR/application or ) n+ n) O+ ^/ b) y* i
$UGII_SITE_DIR/application or
: v. ~$ B' _1 e$ x7 W, E $UGII_VENDOR_DIR/application directory' B2 G5 U3 N, D. a9 @% i& T' W9 T
% l1 y6 K; G* O9 Y$ i. Z! ^
1) Remove the conditional definitions:- y& c& a2 j2 o2 Y5 ?" k- J$ O y* a
#ifdef DISPLAY_FROM_USER_EXIT
c* ~: s S3 ^ #endif DISPLAY_FROM_USER_EXIT
- m! j9 H6 x1 ]4 a' I2) Add a user exit to the function name below, for example, ufusr.
- `! l6 h; n( D3) Consider how your shared library will be unloaded. Take a look
5 z4 X/ u8 L! N+ O7 Z+ E at the generated function ufusr_ask_unload.
" U" q3 J* z9 [& I--------------------------------------------------------------*/
9 ^9 I; m0 A: H! r2 C- W8 c+ l5 B4 P# A9 I" x
#ifdef DISPLAY_FROM_USER_EXIT
) c; ^! E; q' g% V9 E6 X0 ~extern void ufusr (char *param, int *retcode, int rlen)- N9 f1 B2 K' C0 G& K
{7 o% f3 }: K/ h* y* N, X" R* A
int response = 0;/ n% P2 Y7 h9 Y3 ]% z0 ]
int error_code = 0;, O) r8 \+ v4 H* U
1 O K' S2 f. u
if ( ( UF_initialize() ) != 0 ) : K" v, s) `# j" v% g9 D
return;- h0 U- E- T5 n3 T( t
9 H8 ?9 ]9 [2 G) H o if ( ( error_code = UF_STYLER_create_dialog ( "access_dialog.dlg",
' F4 B- E) Y5 p! s3 z. H DIALOG_ACCESS_cbs, /* Callbacks from dialog */; F( H$ M; v& F& }1 H
DIALOG_ACCESS_CB_COUNT, /* number of callbacks*/5 _1 P0 o$ ?3 z- |/ K
NULL, /* This is your client data */& ~% z8 `9 f. m' g. Y
&response ) ) != 0 )
- s% d& z, K+ B, }, e {( I% m0 W, K( a8 B, x! |9 ~1 B
char fail_message[133];+ i J* z& Q- B3 H. d8 s* X9 B, ?9 G
! O; d" Y" L k. v# f9 O- p* o
/* Get the user function fail message based on the fail code.*/
7 H- a9 }% T1 K1 J. w' X# } UF_get_fail_message(error_code, fail_message);) b9 b- U. e: i3 P: d/ q
UF_UI_set_status (fail_message);
) {" u& ]" V6 Z, y; e+ B, a3 P printf ( "%s\n", fail_message );
* G" g. Q0 Y* w8 @& b) U; N4 [ }; |6 q$ T/ f# Q) J) }- T8 A
3 R3 q! M; A4 s6 ~! @7 A$ ?/ a
8 i" X( r" A1 I2 f- z* r: Y" x
UF_terminate(); : e6 t& Q9 M1 f5 p+ v
return;5 X+ U$ I. B# i+ i$ b
}. u2 ^6 {' E* A( u4 T" T
, \$ Y/ b/ m5 y9 L) L3 E2 c) [8 F" u2 a
# a. r6 v9 T K
) `/ E! e. \" D. Z/*-------------------------------------------------------------------------- R. d1 C* }# t3 Q% b1 Z; ~
This function specifies how a shared image is unloaded from memory
4 S9 m+ H) q( U1 Lwithin Unigraphics. This function gives you the capability to unload an
+ N/ F9 `0 K4 ]+ |- a* O' B/ [1 w! linternal NX Open application or user exit from Unigraphics. You can
8 Q# K! I7 H) uspecify any one of the three constants as a return value to determine 2 S5 z# A$ n0 Y4 [0 g+ @: C
the type of unload to perform: immediately after user function / {( d7 J+ j: P8 H) s% e) I" ~
execution, via an unload selection dialog, or when Unigraphics terminates , A: h W X/ t/ m1 I) U' Z
terminates. If you choose UF_UNLOAD_SEL_DIALOG, then you have the : ?; k X0 C) P, \
option to unload your image by selecting File->Utilities->Unload Shared 1 K: ] z5 X* l* x# L# l+ F
Image. ' h6 T+ r. X, _1 E% |; N9 k
: R* p7 g" ~+ ]4 I4 x) F6 V# a) F! GNOTE: A program which associates NX Open applications with the menubar ' J( N5 z- r$ r i' t3 ?
MUST NOT use this option since it will UNLOAD your NX Open application image
& v6 t3 Z ], e- h--------. R! w9 c- X4 ]
from the menubar.% k9 U* I; W8 p* ]1 c
--------------------------------------------------------------------------*/# x4 r9 Y9 T# O9 D: ]8 O" E
/ g7 P2 @7 a4 _4 b u b' S) cextern int ufusr_ask_unload (void)6 I: O' i2 q# [& ?1 q; _
{
" {7 u+ c0 `. S9 o7 P/ P0 O /* unload immediately after application exits*/
5 z. D1 j: @& K! x( f; Z return ( UF_UNLOAD_IMMEDIATELY );# h& {3 c3 [; d2 O
3 r: t: ?- b# t: i2 y! u5 l
/*via the unload selection dialog... */' |- z7 w* X* S
/*return ( UF_UNLOAD_SEL_DIALOG ); */, R" l8 ~" e4 M3 j/ d8 Q
/*when UG terminates... */: f& K: L' J% e1 Q* g( a1 Z
/*return ( UF_UNLOAD_UG_TERMINATE ); */
$ x1 U' {8 w( }6 @}
9 h2 W4 c5 J9 k# Q; M: N! o1 ~6 k) f; u1 `7 ]" x% ?
+ S: c; ^: m) |
' I! E7 [! z8 L/ Q3 W2 L+ }( r/*--------------------------------------------------------------------------
9 J2 G6 s* f2 S$ n. i3 ?$ X, }You have the option of coding the cleanup routine to perform any housekeeping
o! `& A, C" _% h4 Pchores that may need to be performed. If you code the cleanup routine, it is1 H1 e$ m5 S( G- G8 o; J
automatically called by Unigraphics.1 U7 |, e/ G+ g! R
--------------------------------------------------------------------------*/- C ^ t2 j& {) i
extern void ufusr_cleanup (void)- {0 B7 l4 @3 `& O5 Y* d# ^
{7 J: g) B7 ?4 l2 F* L
return; X( h+ S r! U d, f2 |
}* a) R3 s& ]# z( k8 a
//#endif /* DISPLAY_FROM_USER_EXIT */ 5 L4 d' o o) C2 u. _3 Y" D3 {; j
! X1 J3 T, h7 h! N( ^7 F( {
& e8 N+ E1 w7 Q% S4 p& {0 I- b
( R7 s0 Z F* _, l0 x
f; n$ R; n' K9 h: R$ F# S
5 L5 }; U. r$ O7 }- C" J! `. f
. U& r& G; h4 \, q1 f3 b3 `" v/*-------------------------------------------------------------------------*/
0 z1 K: Y1 G& T/ W( B: `" C A/*---------------------- UIStyler Callback Functions ----------------------*/2 ^5 P6 o: A: k; K `; x, t
/*-------------------------------------------------------------------------*/( G7 ]# K- h i! S, v" [ [
4 c+ I! s, V4 @7 s, S* `
/* -------------------------------------------------------------------------
' W2 L3 F. T3 I3 q# R$ j * Callback Name: DIALOG_ACCESS_back_cb
# [) ]- n- D# h& l# g: i * This is a callback function associated with an action taken from a* k% X: X% @0 y) i! F- Z/ u; p
* UIStyler object.
, o7 x. a- E; D' O *
" x) z; N. e, f' G * Input: dialog_id - The dialog id indicate which dialog this callback0 d5 z) l0 A* J$ k5 }
* is associated with. The dialog id is a dynamic,
+ e$ A4 \' _& n8 u$ k: b * unique id and should not be stored. It is6 g4 g8 x% a8 _5 b6 C. ?9 Y# m
* strictly for the use in the NX Open API:. K8 p# q W; Q5 q' U
* UF_STYLER_ask_value(s)
3 z1 C' k1 i% l0 \) P. y4 ]. f' z * UF_STYLER_set_value ) w6 j, }1 a% f ]0 M7 Z
* client_data - Client data is user defined data associated5 r# ]! z3 q! |% S) b2 a
* with your dialog. Client data may be bound u3 m' U/ |8 e1 ^5 F* i
* to your dialog with UF_MB_add_styler_actions
# h6 v1 W8 m1 C" T1 ^8 K * or UF_STYLER_create_dialog. 4 l. P0 g/ V% q. U! `# }
* callback_data - This structure pointer contains information
1 y1 P, ]. ?5 U! v5 h4 k * specific to the UIStyler Object type that ! \8 ~; C' O. Y2 s1 B
* invoked this callback and the callback type.# Y7 b, P( \% v
* -----------------------------------------------------------------------*/! H9 [6 o$ v) D M5 \8 `: }
int DIALOG_ACCESS_back_cb ( int dialog_id,( `' l7 x0 `, _! H% i# n2 q
void * client_data,
2 H) E3 T5 n) J" N2 i UF_STYLER_item_value_type_p_t callback_data)
- w" O+ Q2 E7 V{& S3 I( X3 s" j) F6 H
/* Make sure User Function is available. */ G! \8 a- P) j8 h0 X
if ( UF_initialize() != 0)
& i& `( o9 y; I; t' _" r return ( UF_UI_CB_CONTINUE_DIALOG );* Y7 @) y- y" W5 a. f! t
: {' A; q9 c H3 ^( w; D
/* ---- Enter your callback code here ----- */0 m- |" P; N% t/ Z. o) q; ~
uc1601("您将退出对话框!",1);4 @3 p+ h3 a, e$ k$ U3 X
UF_terminate ();; o* Y: B' a9 Z T+ w3 \
0 r" M; l' H9 i: H8 R# B /* Callback acknowledged, terminate dialog. */% Z0 w6 x8 v: r
/* It is STRONGLY recommended that you exit your */0 y% M0 e3 N0 V- ?2 m
/* callback with UF_UI_CB_EXIT_DIALOG in a back call */# r3 z$ H8 d3 k1 l2 ~
/* back rather than UF_UI_CB_CONTINUE_DIALOG. */
( A! B- e9 O2 z5 M J* A return (UF_UI_CB_EXIT_DIALOG);
; P H7 `6 [* G5 |, X: }* J
3 {2 D3 u& Y, f d: E: A# u3 [) P# ~
}" T8 R$ J* |" A$ P, w6 ?
$ G. C. q J/ N+ z
/* -------------------------------------------------------------------------
$ a, h& y) ~( Y * Callback Name: DIALOG_ACCESS_button_cb; m- N3 b7 }/ e; H& _- J/ @
* This is a callback function associated with an action taken from a
+ w! @/ Z- n3 Z+ ~+ A' G' u* g * UIStyler object.
. J9 L1 E0 S% Q; J' P9 h3 ]/ R *
* q" ] A& C9 E# P1 h) P/ Q9 { * Input: dialog_id - The dialog id indicate which dialog this callback
9 G2 F' m6 {% c) O' q * is associated with. The dialog id is a dynamic,0 I( v P6 z; A `" D
* unique id and should not be stored. It is
/ b5 O, a& m4 u1 h$ Y * strictly for the use in the NX Open API:0 n% R# g' R) n: C D
* UF_STYLER_ask_value(s) - r2 d" M& I6 A+ z6 P+ w+ s
* UF_STYLER_set_value
9 K# e6 U; ^1 j/ Z& v * client_data - Client data is user defined data associated2 [0 ?' \# `3 U$ F% S q
* with your dialog. Client data may be bound
; ?; u" X, Q! }3 J * to your dialog with UF_MB_add_styler_actions- P2 F' l! S$ x3 U* O
* or UF_STYLER_create_dialog. + |; L1 e9 k) t8 {) Q
* callback_data - This structure pointer contains information
8 u' b+ [. F$ m' ?, L( U: y5 K0 O3 e * specific to the UIStyler Object type that " a3 w! D A2 x7 Y
* invoked this callback and the callback type.
) D) b; f2 B* d& h* @5 J * -----------------------------------------------------------------------*/
/ `+ G7 `9 E7 V3 ?int DIALOG_ACCESS_button_cb ( int dialog_id,
( I* a& j: f& e3 h$ @ void * client_data,8 a$ S- g0 X% l- e8 P) \: b
UF_STYLER_item_value_type_p_t callback_data)
P# B; z5 o, K{
' C# _: i( S, f/ }- t /* Make sure User Function is available. */
9 f- a7 {1 X: P if ( UF_initialize() != 0) % S! F* L4 m5 F6 _- v/ j
return ( UF_UI_CB_CONTINUE_DIALOG );
! @9 N8 h* |& s. R: [% v
4 Z9 Q- ^4 ?& `5 T M /* ---- Enter your callback code here ----- */
) f) y e p' A, i" S8 ^, S) s/ Y UF_STYLER_item_value_type_t data[3];4 v, p% @" i: Y
char info[100];, T! G0 g' t5 c
4 N, O6 O* [( }1 a9 i. Y data[0].item_attr=UF_STYLER_VALUE;
8 \! w* w9 W1 i! [' E: X data[0].item_id=DIALOG_ACCESS_INTEGER;
0 K0 L) G+ L6 E5 C0 S UF_STYLER_ask_value(dialog_id,&data[0]);
P+ h. Y& u( t. A, t9 P
0 p H3 ]& O+ J data[1].item_attr=UF_STYLER_VALUE;
1 @/ F9 a3 D3 ] data[1].item_id=DIALOG_ACCESS_REAL;! S) ~7 M0 U0 D7 c* q% N
UF_STYLER_ask_value(dialog_id,&data[1]);
9 ~ F/ D: O. C$ K4 Z8 v2 I t( \3 l
data[2].item_attr=UF_STYLER_VALUE;
/ L) N, t9 ]' l7 p+ f4 j! _# N: D data[2].item_id=DIALOG_ACCESS_STRING;7 _4 ]: W) w# g2 e/ |
UF_STYLER_ask_value(dialog_id,&data[2]);
% @# p& W* @8 `' I
, J7 _1 U; d, ], i; f( m sprintf(info,"整数为:%d\n实数为:%f\n字符串为:%s\n",data[0].value.integer,data[1].value.real,data[2].value.string);1 L1 ]5 m# }+ u! H- P6 X9 ?
0 w$ f- a C: g ^) h$ W
uc1601(info,1);+ l6 o: S: B0 j1 F4 ?# |
2 W; |# j) ^+ x' j
UF_terminate ();- q3 n+ S! g% N U: {
) X% D7 s0 @ z' x& U /* Callback acknowledged, do not terminate dialog */
. \7 C$ F1 U$ u [ return (UF_UI_CB_CONTINUE_DIALOG); ! L5 K7 G3 q% B+ B9 Z2 h) T% J3 }
- w9 D. i: M# s, q7 \# @7 w /* or Callback acknowledged, terminate dialog. */
3 _1 K) Y6 R+ R5 f /* return ( UF_UI_CB_EXIT_DIALOG ); */
) p* F1 Q: ]! X, G8 K2 j; h0 Q% P}
, k& e! o# N1 m8 s+ _, k
1 U. k/ a( L( A* ]+ P5 Q6 ] |
|