|
本帖最后由 ahlarry 于 2012-2-29 17:02 编辑 . ^- c3 _# S1 c6 G2 e1 Y }
- //------------------------------------------------------------------------------
1 T+ e1 M1 y6 A5 y - // This method is required for UI styler dialog creation; P4 N% Z5 r2 W7 O# E
- //------------------------------------------------------------------------------
5 X/ q1 O" d! Q- _2 U - void TriNX::InitializeUIStylerDialog()
/ u# A x% X4 k" `9 T& i I f* d, _ - {1 p8 o6 J, J1 |, q0 h' u
- try& F+ a; \2 A9 ~% S$ K
- {5 Z3 m+ l- c2 \& \/ ?
- changeDialog = (NXOpen::UIStyler::DialogItem*)theDialog->GetStylerItem("UF_STYLER_DIALOG_INDEX", NXOpen::UIStyler::Dialog::ItemTypeDialogItem);
+ X }7 f9 b0 Q7 u: X/ _9 z - changeDialog->AddApplyHandler(make_callback(this, &TriNX::apply_cb), false);6 D$ X. U3 B% P
- changeRadio1 = (NXOpen::UIStyler::RadioBox*)theDialog->GetStylerItem("RADIO_1", NXOpen::UIStyler::Dialog::ItemTypeRadioBox);
' Z# q5 g& h5 m0 r, q6 k - changeRadio1->AddValueChangedHandler(make_callback(this, &TriNX::Radio_cb), false);/ S: M3 H: P l& j$ e
- }
1 b u7 l% N8 U3 _7 Y- j3 O% P. ^% X9 X - catch (const NXOpen::NXException& ex); K" s7 p2 ^2 y7 U' ]
- {+ G; h( \+ f$ b4 @! I4 B6 n
- // ---- Enter your exception handling code here -----
2 L$ X: W: L, R! P3 Y! F* x - theUI->NXMessageBox()->Show("UI Styler", NXOpen::NXMessageBox::DialogTypeError, ex.Message());+ k$ W5 ]2 a+ y* ]; C
- }
. d9 ]. B+ n$ h! W - return;* O- \! |! i; P3 c
- }0 i" L6 ?6 i: [* B: n! A
- .......................................7 J" ?1 c9 x: @( A" Y/ y5 q
- //------------------------------------------------------------------------------
3 {1 o& S% r6 ~" {9 A1 A - // Callback Name: Radio_cb( |2 |+ ^- v4 N2 B/ M
- // Following callback is associated with the "changeRadio1" Styler item." U; T/ k3 i2 c3 f, y& b8 ^! `
- // Input: eventObject - object of UIStyler.StylerEvent class
; Y- G: p' e a: D {) F - //------------------------------------------------------------------------------2 p% n' J: m8 M! X
- NXOpen::UIStyler::DialogState TriNX::Radio_cb(NXOpen::UIStyler::StylerEvent* eventObject); a. f) l% |0 F Y4 j. Y1 ?
- {
9 S( Q) Y" _- } A& c - try! u7 ^; u8 F0 o# ~5 q
- {
6 W3 A6 Y# ? s& L
5 V3 T+ x1 X+ D- & \% {0 b; z# K+ C" V" `6 o/ D8 w
- // ---- Enter your callback code here -----* l0 t/ Y) h- {% S e3 n8 z) ?& r
- UF_STYLER_item_value_type_t value;
1 H1 w! z" a; ], P1 Z2 G( ^: b d - value.item_attr=UF_STYLER_VALUE;
( ]( X8 x. F' s# e& o - value.item_id="RADIO_1";6 I; ]9 t9 Z' v2 F8 k
- UF_STYLER_ask_value(dialog_id,&value);
' _/ B1 t) s; m( Q! I1 ?6 T - int iSelected=value.value.integer;4 x e1 L& i. C( P* j5 K; [* J
- }: l2 u9 D, G: b' w8 |
- catch (const NXOpen::NXException& ex)2 q) W4 s9 C5 z9 ] L
- {* _6 k, i0 i3 j1 f) a; I+ g, h
- // ---- Enter your exception handling code here -----
+ J% F8 m, i- O8 N - theUI->NXMessageBox()->Show("UI Styler", NXOpen::NXMessageBox::DialogTypeError, ex.Message());
7 X: K, v& a$ l- P# | f- ]" N - }* d) X: f# M6 s) n
- // Callback acknowledged, do not terminate dialog
; w8 y3 d5 j9 h+ L5 j ~# {6 F - return NXOpen::UIStyler::DialogStateContinueDialog;
& x2 ^ {" x' T, x6 S - // or Callback acknowledged, terminate dialog.0 s6 r& v5 {* F8 E& W4 N
- // return NXOpen::UIStyler::DialogStateExitDialog;
3 s- a/ B4 R! q" d8 j( i - }! T# N9 S& Z( e$ W( V; ^: ?9 p
复制代码
# [- ^9 l: J' q n1 d- f3 O& d第20行省略了些跟此问题无关的代码,生成时显示 “error C2065: “dialog_id”: 未声明的标识符”,如何修改? |
|