|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb(). [; H- Y6 q9 v3 t# t2 p+ }
- {
! i! }$ q- r1 f - try: U0 U5 \1 Q4 @6 e: Y; l
- {
# P4 `6 Y$ \2 f0 u - //---- Enter your callback code here -----. K/ S4 V, ^. l0 r4 f8 v
- : n3 C- E* {9 u4 G' w2 Q
-
' E3 z( K. l$ O: b+ X - tree_control0->InserTColumn(0,"Name",140);
" S. w. z/ [* c# C2 { - tree_control0->InsertColumn(1,"Feature Type",90);+ f+ } [) V* q6 u/ {; [
- tree_control0->InsertColumn(2," Up to Date",70);
# \% g1 @" P( R3 s) K; Q) o: @
2 s; q5 w1 K. x/ l E9 ~/ `- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);* d! ?# I9 f! D. ?7 g
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);' M( j3 [) J: g7 ~5 @$ Y5 |0 X
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
7 C, p2 H9 ?9 x# Q
$ B6 t- H) ~. @2 [1 d+ j- m1 d- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);% |. W( `( G% @- ^& ]
6 j$ F5 I$ O; T8 ~1 R1 j* }- // create historymode
' ^! c% R' a2 ~+ ]0 F - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst); U+ d$ K" ]: a z Z+ _" d" P
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);# a3 I- \8 x6 d8 o" W5 Z% A
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
& {, w" a2 X7 S& Z, a - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);" Q' v8 w% {6 @9 s8 z
- tree_control0->SetSortRootNodes(false);/ Y- `) l# K1 Q) ^
- modelhistoryNode->Expand(Node::ExpandOptionExpand);1 r3 X# Y8 r9 }4 y$ G% f9 j
- // get all the features with values ( u* I5 m; G6 ]- y# s
+ v; ]5 D" Z. O0 r. H' p- std::vector <Features::Feature *> nodeFeatures = getfeatures();
& l/ z4 M& l4 w- Y* P' B - // insert the features
6 ~1 x+ D& E' t1 o - for(int i = 0 ; i < nodeFeatures.size();++i)
. _. ]6 d% N7 R- B0 m - {+ u L& S7 p( _9 m/ c* G
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
5 I1 p$ @* x m - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
1 B( @1 e* p0 T% V) N, z -
. J, h+ C) u. @* z$ h - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());2 `6 B) z8 ?3 P& \1 H
- featureNode->SetColumnDisplayText(2,"check");
& M, o; |- d2 Z3 W4 u- @' e
: I6 X9 ]0 {' `+ R: h- }
7 h; i5 o/ _# j& n5 W -
5 X& d9 a( J, X) x2 s! \% C& F1 O
0 x% u; v' a6 y6 P- }8 P3 T) y7 _! g* V2 ^
- catch(exception& ex), R6 m1 @% ^2 F2 p0 j. s- C
- {# x0 j9 Z/ `2 m9 G# K6 |% z
- //---- Enter your exception handling code here -----
5 B3 a; g* i5 U! S! Y& p3 h - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
' A' k) |" }+ t9 \! C% H" n - }& M6 e, v: R, L! g$ S1 O5 x, t' e
- }
4 s( m# F3 k* }% A
复制代码 . w+ U2 F7 \, V6 d' |0 R5 H
7 E; |8 a& e8 y) ]6 X8 x
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
$ p4 e+ h- A; R+ e) j/ x" Q2 Z. l% a0 m
首先通过InsertColumn 定义列,有了列才能创建节点Node
% Z% L, W1 ~$ J" S' O" L) n* i% @
1 v7 o8 B, ?( h+ _2 i$ C$ ` o1 J这个顺序非常重要!
# e% I* s. b( l; `" H" h- x
y, Z* h! W- f( n' E! \
treelist 树控件创建
+ B: u6 J* W1 y0 w
2 ?/ K! _ g2 P. T |
|