|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
Y( g# m$ d9 B0 F - {1 ?# f8 g: k& ]/ c: L( j' |! X2 Q
- try
' Q7 A' P& V: f - {
" `% |$ z8 Y( j: J/ B; p - //---- Enter your callback code here -----. z. L7 o/ f' [7 i
- 8 C* l6 e j D8 ^- V
-
* G! g; n: j! h% T( j# l - tree_control0->InserTColumn(0,"Name",140);( S7 j$ Q$ L+ t* d
- tree_control0->InsertColumn(1,"Feature Type",90);( h8 f& G9 N: {0 R! r
- tree_control0->InsertColumn(2," Up to Date",70);2 M+ G w3 x. x( c2 d8 Q* t+ f7 @* u
4 y: }+ E R% D. S% X/ Z- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);1 Z* q& d# e! k2 i, n9 p4 M# J
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);: E; Z$ j9 x3 X$ q+ C! I
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
/ y, N& k8 p6 d$ ]7 f0 i - 7 M$ D P5 O1 L# Q& i9 T: T
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
) O* i) ^7 ?4 ~: @2 e- J - ' J9 h5 u" y M# ^
- // create historymode( v, x/ {. R0 Y) c( d0 m2 X! Q
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
) f C9 ^! {/ W: s; K - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);0 n1 T9 q' p2 E+ w+ t# E
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);2 P: \( d" a' t
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);; e( R! ]! N# [* Y! i
- tree_control0->SetSortRootNodes(false); ~) y( o6 a0 R5 V/ x) h6 t
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
9 z& w" O) G/ \: E - // get all the features with values
/ U, m$ U) a$ g7 k1 @7 X! I - & A# z$ t1 o1 w9 p5 {" `
- std::vector <Features::Feature *> nodeFeatures = getfeatures();; v5 k. g* O, \& M7 F' j0 u
- // insert the features
: ]6 l8 B ~, H M - for(int i = 0 ; i < nodeFeatures.size();++i) S6 s+ U: u7 ]1 U6 v! `
- {' L% `) _0 M0 j# J( F* r* t
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
5 K+ |+ ~" f; ^2 O% j$ C0 ^! ` - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);) i: {9 [1 |- K5 G" T% F
- ; X1 o! T3 P8 v6 y/ u+ l+ g8 a# b
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());( m% L* `5 Z/ [8 }/ H
- featureNode->SetColumnDisplayText(2,"check");
: Q6 C4 m4 B3 ]5 |* m - - N0 s. Z% F8 D8 u
- }3 E. W. x1 n1 g- `: D
-
4 a7 m# @9 K4 S - / T/ z% n9 z2 L8 I2 u) N9 |! s
- }
* a) I) q7 y' {3 u* M0 x* x - catch(exception& ex)
9 @( W) r6 Y; W2 H; E/ B - {
) o$ m, M# [1 H2 l9 P - //---- Enter your exception handling code here -----
d) j" P1 f# B9 {. M+ H - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
: h+ S' F O0 U1 }; k3 c) A p3 j$ d - }% r* k# p2 Z+ y: o
- }
) i4 H8 c5 V% b5 j! G! y
复制代码 7 I2 F3 H6 P5 I( @ c0 U
& A) i, g- ], o9 V
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容5 X8 d, Q! f3 E
. F+ H, `( T* d2 O4 \ D
首先通过InsertColumn 定义列,有了列才能创建节点Node
8 A& |+ ], C; q1 o5 s# T- l
8 @* C* y8 e* Q0 N这个顺序非常重要!
+ G1 F; E% |& B0 N+ Z; p$ D. j: `* t5 H' a1 `# {5 H1 w. b( x9 V$ `
treelist 树控件创建
2 \& {2 Y2 I2 u8 y. N
, w( A" e& b8 v5 a1 n8 ?0 X |
|