|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
. h! W4 B: X4 Q) Y4 l - {( ]) c4 q, \- q+ R8 x
- try
3 `4 K4 p0 ?; b7 r7 l - {. [6 @0 l9 C7 b/ M* d
- //---- Enter your callback code here -----
! J4 L: n/ i. O! o, F# Z4 c
3 D. p1 Y3 y( a/ H-
4 d) a% C4 j9 }% O# B- l( C# ? - tree_control0->InserTColumn(0,"Name",140);, W5 ]2 {4 C1 G
- tree_control0->InsertColumn(1,"Feature Type",90);
: s6 j$ @* s' Z+ N2 Q - tree_control0->InsertColumn(2," Up to Date",70);
# D' A0 o$ o6 a9 w6 P8 f2 l# N& V1 U
# [0 w: \! M% c0 h+ ~- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);6 x; O- Z0 ^& l% d( y8 m. t
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);8 v+ F' C. S9 V* y
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);' O8 N6 n! v" |7 X' d! u& T
- - p7 c( _' `( C8 j) l$ ?0 @( B
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
3 P: W3 K9 w7 `& Q5 F5 L# p
6 q" w& V& P; g9 a- // create historymode
2 {+ V, d' j/ C0 `3 X - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);- i" n' Q# V: W' E" r
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);9 {( q4 }9 T+ u# _" I+ T# K! R
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);; M+ ?+ F" ^9 R# [ \# \
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);& w* \* O3 ?9 n( w4 v$ Y M
- tree_control0->SetSortRootNodes(false);
8 I# |" p. ^0 q1 q% F - modelhistoryNode->Expand(Node::ExpandOptionExpand);$ ^: q+ H U% r, r! M' i
- // get all the features with values
' r( J% Q1 w5 w. J
1 R+ J: g- |( E, ^$ Z! _5 h1 P- std::vector <Features::Feature *> nodeFeatures = getfeatures();
2 c( h% B* F X L" b - // insert the features( T" @- k% B* m/ B
- for(int i = 0 ; i < nodeFeatures.size();++i)
+ _' V' o; \9 |8 U! R& o; Q$ o9 h - {
+ B* |6 ]( h) z6 h3 x - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());, m4 ]5 n3 V0 \% l5 _5 q, J
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);) ?# g# w! s( e" j
-
6 s; _7 N9 c+ r* l. `1 `0 h - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
; h3 a+ t7 q, l4 I5 F - featureNode->SetColumnDisplayText(2,"check");
/ j1 O$ |$ S G* F4 Y
G' p) G5 y0 C+ Y2 Z- }
% K( ^2 ^) ]4 k - : p* `: T" w# E) }: y
- 4 A0 @. [+ k0 z( t. |+ Y
- }
/ s6 |0 f6 n2 C/ U - catch(exception& ex)$ M) I6 X$ R0 x, X- u7 g
- {
% Z+ y; E9 E! T* M, z5 C0 T - //---- Enter your exception handling code here -----1 j) Z, G9 R4 |* C+ r/ [- [+ M+ Z2 ~
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
5 u# s: n7 _5 a6 Z3 a - }
! [: A, V' ]- @, W6 U; p - }
% j% s; `7 o _9 _% r' U
复制代码 6 C: \5 B; S+ q" Z& e
! Y9 d- d2 a, ]* n. C0 m/ s
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
. o$ [- G; \+ ]9 i3 v: @5 p
' P# E+ h- D( [5 [ r& K* Y首先通过InsertColumn 定义列,有了列才能创建节点Node
+ D. S& b9 e" K+ H! Y" m: `9 Q3 _6 M" h0 d4 c6 d ]
这个顺序非常重要!+ s8 v$ g0 E! ]- _, `
: r( D3 T- ]( A2 ^% V
treelist 树控件创建
& X9 c2 d: j! H4 E/ f4 W0 h
; @9 w- q+ a; B/ J: G |
|