|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()! o y+ J" h! y2 _0 X) x0 @( q
- {% z7 S& Z% z N3 D# e L% M
- try
3 j' J( ^; P) \9 B) R# V, w - {2 w2 u7 y( J, D3 }" R) W: J
- //---- Enter your callback code here -----' [4 X; L. z* C( `
- ' t; H' A5 Y- C z7 j
-
6 H0 r1 o+ U. B: K; A - tree_control0->InserTColumn(0,"Name",140);
, ^8 Q1 ] i7 v- l9 I" F - tree_control0->InsertColumn(1,"Feature Type",90);
3 P6 t) l! |) w8 h& w0 g2 Z: Z3 F - tree_control0->InsertColumn(2," Up to Date",70);
+ I8 z# g6 y+ A# {7 v
7 d- j5 o4 r1 T6 h0 @1 z' u- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);6 ]4 G0 Y3 c& u' q5 G+ W$ g
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
3 K) {3 s. p# F. {! D" A# ~: O - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);5 }0 K( C7 Z4 o; a H4 q5 b
( C9 M5 B& s: @/ V0 k' {. c- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);! o9 A) N n1 H! _
- E X E2 B3 w7 A' C h# Q! s
- // create historymode
1 Z/ O; I( R$ N/ y! W: L8 n5 Q - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);) C9 d8 [. ^# j5 O% O4 m
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
! Y- N' R5 K$ ], r/ u - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);" y) h. o7 _1 C: P, c
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
# x9 U+ E/ V/ ?. r9 v% e0 N" i- g - tree_control0->SetSortRootNodes(false);2 m/ \% i8 `* c* Z- x
- modelhistoryNode->Expand(Node::ExpandOptionExpand); [( r( l& v$ \- S6 R7 W6 r' c
- // get all the features with values 0 \* ]! r( p7 n2 A2 |
1 f; N ~# V0 s, `+ M- std::vector <Features::Feature *> nodeFeatures = getfeatures();
7 L8 a$ V5 w. `8 h9 p0 G+ U( E - // insert the features
% G! S2 O. A$ [' Z9 k2 h - for(int i = 0 ; i < nodeFeatures.size();++i)4 S4 y) j5 l# Y$ y; Q
- {
3 I8 m0 W9 s0 M2 K - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());1 U: I8 A+ W/ x) Y8 z) T+ Y$ b
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
/ Q& ^& f& i6 b -
- Q; G2 p. ?9 U: }0 e2 V. m- h3 I6 c" _$ m - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());8 M& @. c2 p/ p5 I6 P( B
- featureNode->SetColumnDisplayText(2,"check");
* U1 [+ Y% F& `; W* O - + u% K" j/ j! ]
- }* N9 B( s' V2 T. S0 y. j: ^
-
/ U) u1 U0 }: l) k - 1 G- r9 ?$ X+ q. P
- }" E! ]" d% y& J) N0 B% E
- catch(exception& ex)8 \3 O2 T" K! N1 Q$ @8 H! M
- {# J& B# ?' ^8 X- z! g/ s
- //---- Enter your exception handling code here ------ b9 S1 E0 h) V
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());, p( Y. j- u6 G; A, _8 E# D; ~
- }0 Q+ r0 U# X7 G8 @
- }
- x$ ~* G# T; w1 U" ]
复制代码 % @4 K* g; X- l# L5 _& F
# X* x" _4 i1 |$ K" H# p) c- P0 B5 W
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容" Y- W* P" k+ _3 c' i
1 V s7 L- E) n9 M: D. X首先通过InsertColumn 定义列,有了列才能创建节点Node
( }+ s# A r9 O* N
+ O9 u& `. m8 i- z这个顺序非常重要!
- K( c; E p7 N7 b6 I7 K. u- \- _/ V! `
+ x& @& ~$ V! L. B4 X) }% Y, s
treelist 树控件创建
7 w' j3 Y5 H7 F
% E2 E$ o4 X8 }4 \ |
|