|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()7 Y% ~. ^/ X8 T
- {' Q2 z1 R% D$ M! E3 e# I# p
- try* J0 v8 Q5 V2 A0 E
- {% }, X4 v1 Y0 T9 P8 z, o) L
- //---- Enter your callback code here -----
' J$ o5 @! F( i, v
, S$ Q/ P* d, f& X8 k2 C. Z- 5 I3 o; i. \) V3 l+ o/ ^& Z% g, n- R
- tree_control0->InserTColumn(0,"Name",140);( W, t# S5 U$ h' u2 W ^8 J4 j% o
- tree_control0->InsertColumn(1,"Feature Type",90);: Z7 M, ?) ?; k+ j. r
- tree_control0->InsertColumn(2," Up to Date",70);
0 l+ x" C. d- j - ( @ o5 n$ G' c8 R& j
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);2 Y& ]* _! T8 @
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
/ e: d# q L% n" m. D J - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);: I9 J5 c \ f" _5 X. P9 y0 ^7 m N
- ) z z7 {2 D ^7 k) {0 n
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);. w3 {$ Y, A4 `
! j- c2 \3 d0 j B) L+ w* Y8 v8 Q- // create historymode; ?8 \' m6 n* ~+ f0 H
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
0 x4 c2 F* F4 P - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
3 w3 O' u: }5 \9 m/ v - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);1 E1 y% V! }; z" U8 X$ b
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
6 ]1 q# F* I# O' e; r - tree_control0->SetSortRootNodes(false);, T% n7 V7 y% {) D$ y3 z7 r! k. U, D
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
, e i- d) m* L6 q" [ - // get all the features with values ; I5 x0 K/ S) n$ [5 m: o- [! \% u
. f. F; _7 g8 n0 C; f1 Y6 S, F2 F/ l& D- std::vector <Features::Feature *> nodeFeatures = getfeatures();
5 a# [; R6 @ L7 Z6 X. d" r - // insert the features. _: P; G; f0 O0 t% B
- for(int i = 0 ; i < nodeFeatures.size();++i)
6 T- t( U0 t9 W/ M" n - {! M5 K# G( y1 X/ V8 e
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
0 J* P; r3 q& \6 U# p - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);( k/ R+ [. W( w
-
* L5 A$ y% ^; \5 V. m8 G - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());, N* d J4 Q5 P1 r6 P
- featureNode->SetColumnDisplayText(2,"check");# v. c* n) G! x! b7 [3 X* ~) T
- 2 _# d' X3 x% D% S: U
- }6 i, {1 t( O c+ y) D1 ?( q" |
-
! T' F' @$ `9 L( H
) Z3 K$ s5 u8 ^$ R2 Q( f- }8 L* `8 L7 Z5 N& K( _# `& o
- catch(exception& ex)+ `3 u5 D. c @% ^7 m
- {
$ L- \& @' _. g8 r - //---- Enter your exception handling code here -----1 Y1 k, M+ Y) j+ o$ W0 h5 y
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());& f" M, ?7 w2 W, ?
- }" c( B, r2 |7 t& A9 x9 T
- }
8 O. C! w# ?7 y* c. M
复制代码
8 b0 y+ j. E7 f1 z$ [4 Y- E2 d5 ^) V" @) K, v6 Q
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容& t( ^. M1 @8 z1 _
/ J# }! H) b3 s F+ h6 S8 {
首先通过InsertColumn 定义列,有了列才能创建节点Node
/ U" W3 h2 X& J# Y5 D8 v0 t
# j- a* B: H# s$ A0 p这个顺序非常重要!: @- J: _* h5 I2 L, }" ~% D9 ?
6 D$ g2 O) N8 j# z
treelist 树控件创建
% G: A! x) @7 x; v* p
( E: j A) y( L' y |
|