|
本帖最后由 ahlarry 于 2012-2-29 17:02 编辑
( N A3 \) J1 I5 w M2 E- //------------------------------------------------------------------------------8 i* z" w8 C& M/ ^& v
- // This method is required for UI styler dialog creation8 N7 X1 W. s/ K. F- f% L7 Y
- //------------------------------------------------------------------------------
+ R, L4 M7 [6 h" k" O. R! Z2 u - void TriNX::InitializeUIStylerDialog()
2 n- |! K3 ?( F) t5 r( T - {* X% J# @3 q! _2 m: H9 r4 O
- try+ y, A' Y4 ?( E3 U
- {3 ~$ P O1 s1 ^& ]: K
- changeDialog = (NXOpen::UIStyler::DialogItem*)theDialog->GetStylerItem("UF_STYLER_DIALOG_INDEX", NXOpen::UIStyler::Dialog::ItemTypeDialogItem);9 v/ F1 ?! A; x
- changeDialog->AddApplyHandler(make_callback(this, &TriNX::apply_cb), false);
3 E& k" {) c3 I M - changeRadio1 = (NXOpen::UIStyler::RadioBox*)theDialog->GetStylerItem("RADIO_1", NXOpen::UIStyler::Dialog::ItemTypeRadioBox);
+ R; W: v. _! t8 D* @ - changeRadio1->AddValueChangedHandler(make_callback(this, &TriNX::Radio_cb), false);0 |3 v% h) r7 v6 N9 T) b, i
- }2 K- ^( b& F. N& X# _7 }' B
- catch (const NXOpen::NXException& ex)
3 D0 S3 M/ R: d) f6 z) \ W# B - { U* ~3 q: ?" p) X% S% S
- // ---- Enter your exception handling code here -----! Z! ^6 y1 L. b3 z
- theUI->NXMessageBox()->Show("UI Styler", NXOpen::NXMessageBox::DialogTypeError, ex.Message());
3 { n& e/ [5 r, c; _8 C - }
& V9 p$ F! Y; e' W/ H - return;/ V R3 q# K) z9 i' c Z8 q
- }5 `# {. H) l- X- p; B- y
- .......................................
V, g- s$ v) } - //------------------------------------------------------------------------------
# f. a! Y+ d* h$ C+ V. { - // Callback Name: Radio_cb
* t7 @% G6 q* g9 \3 x/ f2 `/ { - // Following callback is associated with the "changeRadio1" Styler item.: p' _/ X5 e; } h% W* S
- // Input: eventObject - object of UIStyler.StylerEvent class2 Q6 t! T4 e! G5 D3 R
- //------------------------------------------------------------------------------
: ~ s' r& y/ L* t$ @& v' ^( Z - NXOpen::UIStyler::DialogState TriNX::Radio_cb(NXOpen::UIStyler::StylerEvent* eventObject)
0 _9 m+ F2 W; R - {
. u' y& r$ E( q. L" o" W" l - try
3 s1 @* P8 p; k( h8 t M( k, u/ ^ - {
8 u, E* d" c6 u# G6 b
2 x1 e+ p& U0 Y& U- J+ q; H4 H- O
: u+ L+ H: p: v- // ---- Enter your callback code here -----
7 S* h" w" i" i; I; n% }3 L6 i$ X - UF_STYLER_item_value_type_t value;2 B1 c& z5 ^" e/ k! F
- value.item_attr=UF_STYLER_VALUE;
* r- {; B2 _/ k! w% J" A+ d! ? - value.item_id="RADIO_1";
* A. A9 o9 T) O7 Q" W6 \; s6 y - UF_STYLER_ask_value(dialog_id,&value);/ p/ v! k0 c# Q1 d9 @
- int iSelected=value.value.integer;
) i: M" b8 V9 j# ]4 j7 C - }# G P& L" _3 _4 x* a! q1 G3 L
- catch (const NXOpen::NXException& ex)* \" P( A% I4 \ `- L/ M- y; d
- {
0 B1 g; _2 }4 _3 Q - // ---- Enter your exception handling code here -----, m2 N# C, W# _$ X* a
- theUI->NXMessageBox()->Show("UI Styler", NXOpen::NXMessageBox::DialogTypeError, ex.Message());
" ]& T4 Y: m2 k - }
/ ?/ \0 I$ V5 C - // Callback acknowledged, do not terminate dialog f$ O" y/ _8 z
- return NXOpen::UIStyler::DialogStateContinueDialog;1 O8 F6 U8 H* y* N/ z
- // or Callback acknowledged, terminate dialog.# g- J G1 p" q4 u! m
- // return NXOpen::UIStyler::DialogStateExitDialog;
4 F: G& E! l1 Y, J4 V - }
9 _6 u2 n5 F. s6 _7 \- J+ F
复制代码
4 u( G% k: {# t第20行省略了些跟此问题无关的代码,生成时显示 “error C2065: “dialog_id”: 未声明的标识符”,如何修改? |
|