|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()2 \9 s3 ^& S' d! w/ T+ z( v& L5 G
- {
% c2 J. ]! O4 s. H) V! I - try' L# r6 u; q& V; E+ s( Z. Y
- {
: H4 e+ }" a+ v8 e& G - //---- Enter your callback code here -----1 |% G: ~, o. r" e- Y
% p2 D5 T% `+ p7 G8 S9 J6 A, C-
/ R/ z9 t* O" S - tree_control0->InserTColumn(0,"Name",140);
$ Y+ b- j4 M0 f3 e& r8 A - tree_control0->InsertColumn(1,"Feature Type",90);
, S* q, h8 h* _% f3 Q' C: J - tree_control0->InsertColumn(2," Up to Date",70);0 n4 @) J/ M: U. t
- - E+ M6 |9 C5 g
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
0 z" M1 S" ?& {- ~ - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
- w0 j) B8 v8 Y! {* V - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
1 L0 d- {0 q/ S$ | - + a; D( X4 L- n, m
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
' E( L2 h1 ?* D* V* A
+ P# X% L& n0 t- // create historymode
; x2 ?+ ?' j; Y( p: q# |) ^ - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
! A1 j4 O2 n3 a a3 M3 V$ o# E |7 j - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);+ o& a# S$ k# L, C
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
2 R3 m1 O3 E! _4 z - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
5 z t8 Z. l9 T( U0 Q4 m - tree_control0->SetSortRootNodes(false);1 F/ w9 G5 O( l3 k' }
- modelhistoryNode->Expand(Node::ExpandOptionExpand);3 U/ y' A: q* t Q
- // get all the features with values * T. [2 Y# U I" H% m
8 E4 }8 W0 I' ~- M* K7 Z' G- std::vector <Features::Feature *> nodeFeatures = getfeatures();
5 l) e, D8 B. s: w( y' W7 P - // insert the features
% q; w8 ~6 f8 s; @% T; w - for(int i = 0 ; i < nodeFeatures.size();++i)6 G$ h* A5 N* F
- {. K6 V1 h# P9 ~8 K7 a3 q
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
' _" P6 F- e0 D4 Z0 o6 E/ v6 y. n - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);7 v, z' `/ ]. S' ?+ r! I% O
- # F$ l( }; }' |# Z' _
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());9 U; G" T9 u3 Y7 P
- featureNode->SetColumnDisplayText(2,"check");
$ N- U7 a3 }$ t3 B9 S - $ e- T' P( R) c0 e6 I' J$ H
- }
- W1 H2 z/ Q M8 @, @ D - 1 E; q, E! A6 g) c; i/ G7 o
- ) e. s9 b' d0 }# Z' \2 Q \
- }
' l1 Q$ s5 w0 ~ F) I& } - catch(exception& ex)& \: \! o. A/ W" P
- {
% Y& v# i7 }$ p- |7 j - //---- Enter your exception handling code here -----& M7 w; D h: F4 @* J
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());! `. u! l! h$ Y% ^
- }) J' ]6 F3 |/ p4 P9 ~( \
- }# O' b# v, }; _, @
复制代码 - Y7 x1 ?# ?5 l0 ]2 ^% ?4 l% j9 G! {' ~
; a1 i; T2 t- Y& @2 R1 t2 ~& [treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
: i' l8 A3 y4 `5 Q! Q& P
+ n4 z% O& K% E3 L2 i1 b首先通过InsertColumn 定义列,有了列才能创建节点Node- L. g# A. @( _2 X( Z( k: x
- R; q2 t/ h* G' [
这个顺序非常重要!: W- r! _1 f! b
( v5 [* O8 z; S" t# K0 [! H3 q/ z
treelist 树控件创建
5 V1 q H+ e( I0 n
% F# j1 o* a/ h2 w5 E |
|