|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
- void tree::dialogShown_cb()
# \8 O, a2 G6 V - {1 {+ b4 d0 M* Y, G2 l
- try! g' T4 D1 d5 Q8 l/ }3 X# y8 j7 j
- {" Q. u# s l, u3 e0 W+ _
- //---- Enter your callback code here -----$ f: z& H) j i: X2 E' R
0 h( e8 s) v/ D: ?8 y# `- ; Q3 h. D' X5 h( X
- tree_control0->InserTColumn(0,"Name",140);
( a6 H2 v8 e3 X - tree_control0->InsertColumn(1,"Feature Type",90);" Z1 M& x8 |8 b5 d: ` R+ `+ B
- tree_control0->InsertColumn(2," Up to Date",70);3 I C. ?" a9 Y/ u, q
- + G4 ]8 t# r/ g( a* {0 l+ [
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
/ t$ U T2 P9 l7 X2 m8 K - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
( v( [ q: y% r+ i; Y* [$ A - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);( r3 j( ~* K0 H6 i0 ^
- 7 k& J4 }7 { e" s8 Q3 F( d
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
; y' o* X. {# Q1 d5 E# S9 d - % n& U7 ]' F1 J$ V$ _
- // create historymode' `* P9 g0 f9 K- S+ x3 N
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
. f- W- N+ ?3 u. v- o! l; d, V - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
# y% H1 W8 J( M, w - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);) Y( c* V* K# ~ W
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
6 h" S. S8 Y2 g3 _: t - tree_control0->SetSortRootNodes(false);
+ q7 O4 x. j7 k, ^9 `) i/ @ - modelhistoryNode->Expand(Node::ExpandOptionExpand);# V. H# d; x( p/ Y% j4 J0 o
- // get all the features with values ; z/ g* r: T; A
, w! x9 O; A/ O0 A3 v' v0 P- std::vector <Features::Feature *> nodeFeatures = getfeatures();
) w# a7 C0 z* ?# p- l/ k - // insert the features
1 C5 i$ P. b& C8 T& J. N5 \ - for(int i = 0 ; i < nodeFeatures.size();++i)0 y$ g! N) j+ v( I+ Q3 W. E# O; R
- {
+ L# L/ ~7 G" X9 G( w5 O - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());% h. G J. x4 W# a5 b+ k
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);0 |; e) f/ y: T/ j( R6 ~) e
- # [2 G1 P' H' P1 \7 Z
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
3 J6 W& N* t9 H4 F9 ] - featureNode->SetColumnDisplayText(2,"check");) I6 c* e- J' b: R0 I0 H; T
5 e+ Z& x1 ~! L& |- }0 E& ]# h) z% ~7 n% D
- - W: E' k& l" o2 N
* [, ?0 h! {4 u1 G- }: J& m( L) s7 Z2 [& g) d* R
- catch(exception& ex)& j0 T" I N' M7 W
- {* x) P& A3 R# d5 \9 U! \
- //---- Enter your exception handling code here -----
8 @& n6 C+ `, B6 d/ i9 x7 s - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());( V. j+ E( K. m5 P* R4 U
- }5 K/ l/ [" d( J; h) c
- }9 t7 r b' o( x) J# q% ~
复制代码 ( }& {5 ?5 k5 _, m. W! X8 M
& r' d" r' ?7 A7 i9 [8 I( itreelist的创建,需要在dialogShown_cb()里面定义treelist的内容6 M4 L. s3 Z7 X9 ^2 s5 s
# X$ X3 e% s. S
首先通过InsertColumn 定义列,有了列才能创建节点Node
, |- ^& ?1 Q" i8 Y
- U- Q* W( @) {0 x- e& d5 O& C这个顺序非常重要!1 q% ?. A1 T: u. c7 @
* k" U# N* d( e3 j% f6 B) M
treelist 树控件创建
% f1 m6 l4 ^; y, ^+ N
0 Z C/ g2 i9 b' U% S3 a |
|