|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
8 O3 V5 Y( j, r& L6 p+ A - {! ~. Y0 M9 C+ H q, n! ?
- try
^' r7 x4 N* y9 m+ r% F. K) X - {
) G" a+ @0 _4 @( c1 h' j7 w - //---- Enter your callback code here -----
8 y; m% I8 K# }3 u0 Y/ ]; { - 5 l' b* g4 V4 ~' n- r
-
/ |( u6 A4 L- S6 s$ n" g) } - tree_control0->InserTColumn(0,"Name",140);9 o9 K: q3 o6 ]
- tree_control0->InsertColumn(1,"Feature Type",90);3 G9 M2 y/ y0 M K
- tree_control0->InsertColumn(2," Up to Date",70);& Z' n% p1 F! |$ u6 p& R! e
8 \) Y: _) z# i. R' q- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
# b; l$ H' b, [9 b6 S - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);$ f2 s7 l+ ]: {
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
8 R* S& x' L) J9 W4 j - 6 R4 I. C3 h a% [+ u: l
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);9 h! p, q, p" g* Q4 v3 s
" ?$ F7 p) B. b0 ~/ G4 {5 o- // create historymode; Z$ U! `5 C6 a
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
( J$ Z6 }& i# a9 ~: W - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);' g! y$ L# _' a# ]+ K2 x1 O
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
6 i1 ?. O0 W% I3 H$ j - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);$ ?5 p$ @; D: X. Y, t, ?- K
- tree_control0->SetSortRootNodes(false);1 S( q1 k, y7 c1 ]0 [
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
6 I n! F0 O: g2 R* [9 B6 } - // get all the features with values 9 J! v5 }+ n$ k2 ]
4 _+ S( d( f4 L' E" V- std::vector <Features::Feature *> nodeFeatures = getfeatures();" Z }+ O+ O% _/ c3 F' K& H
- // insert the features3 z% K6 i' m( `6 z3 ~
- for(int i = 0 ; i < nodeFeatures.size();++i)
2 O4 D, V `2 W6 M$ j8 H - {: ~" U0 t& Y& K. j% A
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());6 o* Q* `! {5 V/ t
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
0 r# b. z1 v. N- K- f -
5 @; r" S/ \- Q6 | - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
% ~% \$ A: G4 ` - featureNode->SetColumnDisplayText(2,"check");( v2 a [2 R" g5 t
- 1 s) R6 M1 a& a) y- `6 H
- }
) z& u- u$ L T) T m -
. Z, e. _! k9 x% ` n - ! c }" L) M# O4 m, C: s. d( z; A
- }
+ F; w+ L1 A( V( C; A( [0 } - catch(exception& ex)
, H, K9 z% `7 q0 M7 o - {
0 B) Z* z: d H% T - //---- Enter your exception handling code here -----
5 _- O2 @0 s' T6 c - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
' T. H1 |# G$ u' i9 M - }3 R# }/ e4 Q* y' l8 @" y/ `" [. |
- }! k- C7 c m. ?
复制代码 # X3 y) z: r7 f/ p( A
7 g+ i- O6 ?( n- C) y* R
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容: ?1 u! [4 R' p
0 ~% h- v2 w' r& i! |) x. \
首先通过InsertColumn 定义列,有了列才能创建节点Node
# p. h, W3 B$ r" H% ^! H2 l7 U& d0 b" n1 a' a; }" s
这个顺序非常重要!
X8 u5 H. N, x$ ~: K3 `
2 A, ^0 S5 d2 v: U4 W" \
treelist 树控件创建
* J6 `& a/ u# V C- A# s' w# }. j" A, k
|
|