|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
' q9 i# e6 R7 e" O* W/ D - {" f0 ~/ R/ i2 k; K5 M
- try" T7 R+ ?3 q0 P9 a0 p2 _2 M. _. k
- {
2 l5 a/ F& u) j6 |5 b" k* G+ l ^1 v - //---- Enter your callback code here ------ v. |" Q( F3 |3 K
- . `! H6 B+ J/ M) |5 k- `
-
6 z) p# H6 r2 S9 U - tree_control0->InserTColumn(0,"Name",140);* G( X: U( b. k3 Y* c) w5 r& u' w
- tree_control0->InsertColumn(1,"Feature Type",90);+ ~) i; g. I, A# Q: I( o
- tree_control0->InsertColumn(2," Up to Date",70);: i# O! Z4 f+ a. z
- . _4 O7 l; s0 a' ^& h9 W; ?
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);9 D% X' _! u+ d' G( V
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);& R) y K! h+ H3 |. R2 N- m
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
+ \ e) B5 O9 s) L' C+ ~1 e
- a( x/ Y* M6 W) f$ H7 ~% ~1 ]- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);# x! Y4 k2 n. T) }9 n4 _! e4 Z f
5 m. z# F" H7 J- // create historymode
2 Y8 Q8 g4 T5 O/ [ - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
0 y! G& e' a3 q" F - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
6 l% h9 E) m0 _/ E7 h" [6 t - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);. L0 Z+ G- ?$ c& }
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
J9 v5 r ~: Y$ r9 d$ _1 N6 V - tree_control0->SetSortRootNodes(false);' m" E/ w/ F1 i; F, ]- ]
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
/ W$ x8 m( q- M" J! ~+ m0 m - // get all the features with values
3 y% f- f1 \) p6 G& n, U4 M - , l3 u" z- L& X L6 \1 B
- std::vector <Features::Feature *> nodeFeatures = getfeatures();0 P3 m+ J( ^" Z8 A. r' N
- // insert the features3 d( ~+ a, C% V6 e- }
- for(int i = 0 ; i < nodeFeatures.size();++i)
0 V: O8 N/ { `- P6 u5 H& O - {' e$ i% @: Z8 Y6 J
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
' V' V+ K3 f2 W, }; R - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);, [* S* ~9 _, D3 q% K/ f( H1 z% i
-
+ ~3 v ]/ E( O - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());0 d6 K; I n, o, z4 v) ?0 \
- featureNode->SetColumnDisplayText(2,"check");
6 F. _2 S* d- _4 h; K2 ^
. |! b h2 ^1 v- r$ b- }
; J- E7 u( R7 h0 x2 W6 B) a - ' t: Q1 f! u6 b5 N- C
- " B" f* a: _7 v' T
- }
0 Z8 S( C$ r- r - catch(exception& ex)
2 K/ F2 \# P+ J0 T - {% r3 A2 S% l) A! p$ F. }
- //---- Enter your exception handling code here -----
# R$ @! X) k6 i+ q - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());0 B0 Y: h8 D+ |8 b1 X
- }9 v7 V6 r1 s9 h0 M0 f8 ~7 X
- }
( |/ ]6 `. H" J# W1 o; c: c
复制代码 " J3 Z: a! g- N# \$ B1 @; [* n( y
4 w) r2 `$ {7 n! q, [) c) M6 F
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容) {/ F: N. d# c1 q
3 z# u$ E9 c2 s% z p8 b首先通过InsertColumn 定义列,有了列才能创建节点Node* s5 i" y( T5 g
- W+ @' Z: a2 ]/ \# a这个顺序非常重要!% X8 T8 R. h6 h/ H) A5 N" E
% {8 `& F" t, o# R2 ?9 O9 p8 j% q
treelist 树控件创建
/ |' J- c) q1 s% T6 G
( r4 V! [2 r0 t8 [: \! m |
|