|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
6 X& R5 g' {; z1 o4 m! K - {
/ B5 y D) o; f/ U - try
3 ?) o7 N4 T( u# g6 _ - {& \9 ^( O' U$ B- R; x" Z5 M
- //---- Enter your callback code here -----0 E# x! d4 I S. O/ X+ Y% \/ f
' Y- J; G b) W- , r1 p8 B6 W7 }6 v; x
- tree_control0->InserTColumn(0,"Name",140);$ B1 p( {: G/ q3 }$ \% c
- tree_control0->InsertColumn(1,"Feature Type",90);( @1 ^" ]$ j+ h+ Z& B' p" |2 R2 L9 y9 I
- tree_control0->InsertColumn(2," Up to Date",70);
9 z' Z. J3 Q7 i$ j% t4 ~
4 p" P+ m# E- y& O3 c/ [9 P- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
! k% T% s& C; [9 n - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
# d8 r" L- q, J - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
. s, Z4 X6 S# u" S6 q3 H0 d% t Y - $ l% h( C( ~& W. F" M0 e/ O
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
$ p. F3 ^% T% V v: D, V7 e - : o! `( U" P3 v
- // create historymode
; D. X6 R. \$ M' V, V! x9 M - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);$ q" c$ v3 P$ }
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);9 N E7 S% ^# A
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);3 G, I* W5 f1 ]9 e' Z) S8 p
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);: O% f8 \: `' K/ A
- tree_control0->SetSortRootNodes(false);
0 P; Z) n7 }7 v- _ - modelhistoryNode->Expand(Node::ExpandOptionExpand);2 z' V$ t6 e8 E Y, c' b$ I3 e
- // get all the features with values
: u# w; m& |( H4 q+ B A - 6 }# r- ~5 X- F% G* u
- std::vector <Features::Feature *> nodeFeatures = getfeatures();" }; E+ B% k; M/ O
- // insert the features3 n+ A, \: K8 z) i/ w# A
- for(int i = 0 ; i < nodeFeatures.size();++i)
: O8 f7 ? T% g1 h - {" ]& c& v2 |2 E; d9 A
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());! C5 K O% ?8 ^ ~
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
2 H1 E4 Z- A5 S: O. c3 I - - P2 Z$ K* O( t. m- w C
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
+ {: H6 B4 I) m# k. T - featureNode->SetColumnDisplayText(2,"check");, c; \5 f9 \' h- a5 V' M
- 8 `/ U1 q9 o' q- P, Y+ f8 e
- }' ?) u* Y* B M0 i/ ~9 e
-
4 O4 A# H2 ^! S% M - $ q" E* j7 ]9 g/ B e
- }* M6 I$ Y) g; V, m, _: ^
- catch(exception& ex)
& E/ \, k$ K5 H! A- E+ X - {
. q T- f2 y. d: j* J# a/ p; b- s - //---- Enter your exception handling code here -----
/ f( D) ~2 U; W+ @/ F - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());" u9 U% t H, d
- }
0 J% f: l Z9 F, f6 ]$ W: c - }
/ B' C2 F, Q, b7 m; M4 `6 a* Y
复制代码
5 i! ] g& g9 k& g2 u3 P. t& I) C7 V( i
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
2 p8 T. } y, i4 v, ^ H8 J( n& |& Q- e
首先通过InsertColumn 定义列,有了列才能创建节点Node0 K) Z8 Q) M7 q/ [, M6 F/ E5 O
5 z9 @5 s& Z' S+ s3 Y
这个顺序非常重要!
. B& j7 o3 j( l6 h/ s' }5 H7 F9 P4 W; F6 V4 S+ \ D' v
treelist 树控件创建
9 `3 \9 d1 }% c
8 _# ~4 {; @) z' Y( T7 M) Z6 c |
|