|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()& Z+ f+ J) `1 d( e6 C k
- {
6 c4 F1 n$ l6 K* x5 z/ b0 o - try& M) P1 f. t3 O
- {' A& ~" M k, |6 B" d. B8 Z
- //---- Enter your callback code here -----: N6 m; c4 V4 f2 w, }
9 k8 x1 W. G, F4 v3 V-
8 s) Y, W5 d/ ]$ v+ I# O7 A# h7 c1 c - tree_control0->InserTColumn(0,"Name",140);
; B- i3 `( ^$ h4 C - tree_control0->InsertColumn(1,"Feature Type",90);
: Z5 A q# u1 p! D, F9 P$ F1 c - tree_control0->InsertColumn(2," Up to Date",70);' p* V+ p) d! S: I4 P/ X/ h( J
- ( F- q" r& |! O8 M/ y1 h
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);' S5 v# q1 @( E' J1 d. M; D
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
9 ^3 x- J. x, e% n" u - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);1 J' s0 e; R, i/ g; o4 a
- $ u5 O! `* N$ G" C- h9 ?; U
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);' m) r% X0 P8 X3 r& ^* e8 J
- 9 d+ R. S; V1 X% C
- // create historymode
) T8 s- u- Y) g/ V: F7 j - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
; t+ f8 v8 S& {7 g/ J - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);- u5 c K* e X* _
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);6 _ B7 A3 L9 }! l6 N
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);! c2 r/ S+ S+ Z O" y' [" w
- tree_control0->SetSortRootNodes(false);
( l. ~. |5 [. L, \' y) k - modelhistoryNode->Expand(Node::ExpandOptionExpand);
( Y, p/ x; @5 A$ ^5 O" H! M: |! K - // get all the features with values % G+ ^9 y5 v7 f% ?% }2 z# n
7 I2 C c( v, g8 c& b- std::vector <Features::Feature *> nodeFeatures = getfeatures();
# v8 ~) c6 `% A Y* B. L* W8 p - // insert the features4 y( Y% F& y% H
- for(int i = 0 ; i < nodeFeatures.size();++i)
3 i. K$ Y4 l' H1 x3 F, U1 A g - {
4 I* l/ h) b* T. a* E6 v - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());# ~" l; d" F" i( C
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
. B$ F) c% G& v0 t. H; q -
, ]3 h8 ]/ H: G) A - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
% z$ f* }" Y; {1 i3 i - featureNode->SetColumnDisplayText(2,"check");
/ N4 I2 b7 u9 Y) G: [& s/ h% b
. Z7 u2 m& s- i g2 h- }
1 r F7 s Z0 y% P - & t5 Y6 Y( `% ~) ~
/ m; Y, `% h' s3 u( q5 l- }4 M( J2 l0 S/ q" w4 A. k* h. ]
- catch(exception& ex)
& o+ z8 X2 u/ Z: ]" b2 c: K7 j/ J - {. u" n3 U1 [& D9 N! e( j
- //---- Enter your exception handling code here -----
/ Y% r |* a$ n& x9 K! q - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());: f6 G: T* B/ b p7 c* B; C
- }
3 k7 [; G4 r& n4 V9 W8 j3 f1 g+ C - }0 Y- w1 n( O2 E
复制代码 0 a; U1 n" ^) h+ w( ^2 M
) M1 _; X$ i/ Etreelist的创建,需要在dialogShown_cb()里面定义treelist的内容6 a2 F4 T: P* K5 k8 h
8 s5 @6 j Z2 @* l) o8 m0 l! P首先通过InsertColumn 定义列,有了列才能创建节点Node
4 x7 c$ F T" c/ T7 `
9 ~) C: B6 M% p5 k! f这个顺序非常重要!3 T( |- J4 a; l! h4 G H
/ H1 _6 L; ?# |" j' A; b
treelist 树控件创建
; f0 |8 N" \6 P4 A1 }
' Y- M6 k W4 @ |
|