|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()* u2 a! R/ ]* ]9 c* f
- {
# ~2 e& d) s$ j% u! v% B$ U' Q5 |6 L - try
5 c# t$ ]9 M% N6 E* B" |7 D$ S - {9 w6 p) |& Y7 A7 |
- //---- Enter your callback code here -----' P' N" Y% k: u$ ? T
- - {( H1 r6 g. z H4 @& C
- : z- p; J" V0 V" ]0 @; U1 I
- tree_control0->InserTColumn(0,"Name",140); t5 M. ~! \! j: Y% w
- tree_control0->InsertColumn(1,"Feature Type",90);
4 B+ [# n+ N: ?4 H' {. j - tree_control0->InsertColumn(2," Up to Date",70);
2 {5 g& A+ m6 p; m& F - 7 Y9 k4 T7 N1 T0 c) w0 n/ O/ E. h
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);* d/ ]. |$ a0 A! J) d/ S* V
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
* j. c2 g5 d$ N. C - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
3 d1 F* J, _7 f6 _ - / }* m, f" v, m* }2 V
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);5 t D! t4 k& _2 U
: u. V; |. _" T% ~% t7 I- // create historymode6 Y: X* o- h! G; U' ^
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
0 |1 E5 Z( {+ s3 s$ }6 f: k- d3 j" | - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
* Q1 Q& h F4 L( C7 T7 ?, l - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
: J6 [* X$ c/ v; a- C - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
' f: n9 }. R: P0 a; r. L$ k* ^ - tree_control0->SetSortRootNodes(false);) s; N/ g( d4 c/ R
- modelhistoryNode->Expand(Node::ExpandOptionExpand);# m$ o$ P( f* m9 e3 G: n+ ?
- // get all the features with values
! _) z3 D) ~& b) D# W0 q1 l
2 l! Y' \% Q+ V- R% r* t# v- std::vector <Features::Feature *> nodeFeatures = getfeatures();
/ d/ D7 d9 ]/ {4 n7 C- ^ - // insert the features' I5 X2 c8 Y7 [9 m- g
- for(int i = 0 ; i < nodeFeatures.size();++i)
/ N9 t6 m. k/ p9 \. h" E - {
( a3 t% D( @2 D3 c+ v - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
6 J% d' F" \! {% D' t0 v - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
6 x5 M) c& n ~ -
! m( l3 ]9 Q! {$ h* { - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());: Q6 h2 O' g9 z2 U1 [$ B( {
- featureNode->SetColumnDisplayText(2,"check");
4 Z: f+ a+ |" t$ F4 E X+ I - . v0 Q/ p7 L8 n5 u1 P$ q
- }
% x: u/ j) ?9 x+ ?9 Y% Z8 ^ - 0 b' v7 ~$ {" ~/ Q! [5 x2 E
- 5 ?* P$ ^2 ?) `0 d: N
- }" s p3 X6 R8 }# k; w% [9 Y. `
- catch(exception& ex)
: W+ l1 }% M, h - {9 ]% u2 ~# v# j* j/ s4 w
- //---- Enter your exception handling code here -----2 E& P8 V6 q1 i7 Y. ~& q1 O3 W
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
- m( g+ K& R J/ [% |2 C t0 A* F+ r - }
; \) T% b% i; j1 n - }
6 S, m+ l' V4 J7 _+ q, _
复制代码
% u& r6 H! B" L% \; E- b5 H3 Y- {9 ]1 x( W
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
+ x( A; _/ Q# Y! k5 i/ f" l
2 `: O: W$ z, T6 v首先通过InsertColumn 定义列,有了列才能创建节点Node
7 m2 ~, B" i2 @! E1 _6 K. {
: j# u$ v8 a5 q1 F6 Q5 h这个顺序非常重要!
& o9 {. P ^. {- L! M# o# C& ?) A1 T3 H4 O' ^
treelist 树控件创建
& R- B7 r% t8 ?
g% L+ k3 G ^+ g/ T- w7 ]7 F& a8 K
|
|