|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()4 N5 k c6 F* c) ]0 u
- {+ w5 N- Y; ]5 F! z! U9 h
- try
, Q& M2 Z! e, Y7 c" g+ l - {& c, H3 u/ ]) P' _% D2 X& S4 F
- //---- Enter your callback code here -----8 z$ t8 B a: b2 T6 S
( n5 _$ {2 U o+ ~: d-
% c/ F: T8 W. Y& h. J1 \9 k( [" { - tree_control0->InserTColumn(0,"Name",140);4 [' h# q4 q: d2 s
- tree_control0->InsertColumn(1,"Feature Type",90);
, j$ C, [1 g8 {1 Y9 h - tree_control0->InsertColumn(2," Up to Date",70);
( t3 `, U2 d6 S2 z- F - % D8 ~- B7 d2 u$ u! Y. ~
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
7 J4 y* F) z/ s- X* I4 @/ Y - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
% ^4 t3 n9 G# h; N0 u! q/ s) {) m$ t: i - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
( T0 j! _& i/ o+ A' G
6 v9 x6 r" k( b- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);5 }% p: }" v4 k, N$ H+ G' Y
' @; g* B- y( y! Q* ~5 E9 C3 V- // create historymode
5 }- |1 y4 \: o5 i - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
! e% i4 s# B7 Z9 p$ W - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);) ?' S+ P( Z: Z( l; T; N
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
( `9 F0 N5 d$ o' U( t9 B - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);0 Q( j" }( ]7 v, C" ]3 V
- tree_control0->SetSortRootNodes(false);0 Q6 a' Q F; N8 n# m& Z$ [6 H
- modelhistoryNode->Expand(Node::ExpandOptionExpand);4 O+ z8 H6 u) I t" x& `
- // get all the features with values
! u2 ^# @5 r5 l' s* p - ( B0 t/ l+ a( O- Y$ a# R
- std::vector <Features::Feature *> nodeFeatures = getfeatures();
+ E1 I. u7 n0 p. D* j1 ^' s6 _ - // insert the features. {- w* V7 |% H& j4 m, p
- for(int i = 0 ; i < nodeFeatures.size();++i)9 c& U9 p3 ?, L$ ?
- {" @$ t+ l# X3 {/ Q4 J$ t( M
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
$ |6 T0 y( U& K8 ~- W% l - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);, _) V9 Z, A6 h: ^
- A4 R) C# D1 o) L& o- W( S. v+ _2 @8 n
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());3 m/ p; y3 a" U
- featureNode->SetColumnDisplayText(2,"check");
& Z0 O! ]( Z' J) t! a( @0 G3 e - % e9 b8 e3 O1 ?' [5 t( K
- }5 S8 F& V6 ^/ J6 X0 s
-
q1 \/ V# n. A, D - . ~6 V: |+ W, E: S( n, g0 E3 V7 [
- }
1 L, l: i4 ~ \/ ]% E - catch(exception& ex)
8 [' b4 ^; C1 h7 A; D - {
; d& J6 y7 t4 P% |+ k5 ?% U - //---- Enter your exception handling code here -----
' @( L% B; k" R - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());4 s S8 T5 F: B ^9 a# _
- }* X" w9 C5 T; @ h. q2 F
- }
) M" K! R7 D3 A5 [& T
复制代码 / ?9 c+ t1 `# k' h- i
! N; e0 _& ]% X8 btreelist的创建,需要在dialogShown_cb()里面定义treelist的内容
8 z @- L! c& J& m0 r! X5 j" Q" G+ a0 R) \; P# [
首先通过InsertColumn 定义列,有了列才能创建节点Node
$ Z- q1 x% k" c+ w* x% S
& s" [8 a, u! g8 j8 y0 M5 B5 v) A这个顺序非常重要!
2 N* c: f4 [! `
( R5 b( e( C, Z M5 ^- _
treelist 树控件创建
# M5 N7 u, ~9 d) V9 S# Q& ]$ T7 a5 e
|
|