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