|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
$ g j( E0 I _# e - {
" [- P5 x V7 o8 ?' t, ` - try
; G1 y' U" b2 L4 E& w8 d ^ - {' v D# \! ^' A4 L3 \7 A9 f
- //---- Enter your callback code here -----
2 L# t: ?* N( v4 U
) u! j* w% x* q$ k9 q( p-
6 x1 ?" L$ t" u, G - tree_control0->InserTColumn(0,"Name",140);
! `8 }+ z: R* i$ B0 Y0 Y" E4 Q8 D - tree_control0->InsertColumn(1,"Feature Type",90);* ^6 |% |$ i6 s( c% ?2 S9 E
- tree_control0->InsertColumn(2," Up to Date",70);0 i7 a( \; V& g$ T6 [. [0 _
- : F+ ^+ A7 o5 N2 X" `
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
6 n( h( ^; j0 S; L5 c: K - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);$ O2 `6 _4 Q, v4 Z9 @
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
) {% W9 [+ M5 X4 j/ B - : d# l2 ?3 F& r+ D) s
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);+ b1 n9 ^- T2 K- x+ s* a
- & o2 {+ ]! ^6 A& U7 i
- // create historymode
! p1 W& b* M: a0 z( G: ~ - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
, D* Y! P! ^/ W - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
- H& f. l4 g5 |; Y# d1 c2 W" T1 C+ a - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
6 Q9 A) C. V" G% c$ o - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);1 e8 X8 P9 _( Y4 g' G
- tree_control0->SetSortRootNodes(false);0 @. @' n$ D+ n3 i$ F( h s
- modelhistoryNode->Expand(Node::ExpandOptionExpand);! |# V j( l& |) ~6 M
- // get all the features with values 0 k- P: ]# O6 n* A { U
- . y3 \5 | W) Z6 s9 Y& p
- std::vector <Features::Feature *> nodeFeatures = getfeatures();: c# l7 R" k* b( e ~
- // insert the features
3 ?: s: Y' ~0 { - for(int i = 0 ; i < nodeFeatures.size();++i)
( O6 V+ ?4 e1 B - {- Q" j3 R" U% H& t$ U# P2 i' s
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
6 U7 j. i, z2 `3 { - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);1 e' t |% n- |. p1 \' H% @# h/ w1 H
- , l6 R ]( U0 j7 H! Q
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());+ G1 o2 b9 [( ^) b6 h9 B
- featureNode->SetColumnDisplayText(2,"check");
. T. X. o o" c' H& P4 ` - % \' e* }) O' Y# P! \7 ]# |2 d
- }$ c. R! L( t9 `; n* ^
- + k6 |0 g, b! N0 y; J
- 3 j+ q( y/ z2 A6 u
- }! I$ j$ O' c+ \7 p0 [
- catch(exception& ex)# O2 W6 S r: u0 @+ k, N
- {
2 O! [- o+ T* f: b6 \# D - //---- Enter your exception handling code here -----
# ]) L9 Z# h6 G+ z$ X - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());" G: l' J. m1 ^ ^! K% C8 e% t! d% |
- }$ M7 f# ^7 }7 z4 z9 D8 H
- }5 I+ q( M$ q+ p5 l1 h7 F
复制代码 % Z {; L! h& L. K
9 N& G: {: _. O# htreelist的创建,需要在dialogShown_cb()里面定义treelist的内容3 I/ k8 H" m( @+ i; P; e
; B) k, V. r; i首先通过InsertColumn 定义列,有了列才能创建节点Node
$ w8 `( Z6 L) Y" [
) _1 ?2 ?8 I. v( I+ U5 ]这个顺序非常重要!
9 ~; t& x2 v( E6 F% Z1 u) {0 G! s2 _1 [! i3 L; A) c4 t( g
treelist 树控件创建
, l6 W) ~& E- W, _1 _. ?+ U3 @8 w0 i1 f( B0 A2 ~+ m! v
|
|