|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()/ T6 E# B/ Z- n2 H5 h- Y
- {) e# E' }( q3 e
- try1 v, G4 m) ?4 a) w
- {
# m% S4 }; w: r, K - //---- Enter your callback code here -----
! j$ x: p# @- Z- y" q1 T - - C" g4 ?/ }! \, `7 e) h7 C9 a
- ' r) N6 d8 e7 a0 w( j/ w6 W
- tree_control0->InserTColumn(0,"Name",140);
3 v' ^% ?- h) _5 I: O - tree_control0->InsertColumn(1,"Feature Type",90);- S' l: e/ E$ l6 U( `1 a& k
- tree_control0->InsertColumn(2," Up to Date",70);# }# H0 m( G0 c, B
- % M7 t! F: j6 o9 e- F0 v
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
+ S9 |1 Z* d; l& c" I7 I - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
, I3 M2 y( W# l" |: A - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
2 D+ S1 N/ B, F W" d. a- p; n2 k- z
! R ?0 l. ^$ W- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);3 K2 T- L9 ?; A# N# P# a
& C( S1 W0 R; @0 W- d9 ~; K- // create historymode
: v. ]1 w& B. w - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);3 c! A3 n( y/ p1 r* v
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);# }: c1 O y' p, e
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
0 \- u1 F, C7 G - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);- }- I5 Z Q1 e$ v
- tree_control0->SetSortRootNodes(false);/ `" k+ R7 Q% S; Y) T* g1 u
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
' v) ]4 r Q& b' C+ ~$ t - // get all the features with values ( w" l0 v' `+ B, a( }
% i. K, u, }# [& r7 H# `- std::vector <Features::Feature *> nodeFeatures = getfeatures();
3 e. e4 A! `3 ?) h- W! b+ { Z - // insert the features
% V% m6 M+ L- C) B% t- R o! j- g3 S - for(int i = 0 ; i < nodeFeatures.size();++i)( P: S+ z K" @5 ~
- {
: o9 J6 D9 U8 V: H! y' V* ] - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
3 I! o( g) w$ V7 { - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
0 L0 I$ p$ m0 m, o3 A' T" s9 K - ! L p2 v/ L2 S! m" C
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
; k E4 c0 m% ^# @& s! ]; ~0 }" R - featureNode->SetColumnDisplayText(2,"check");
3 o$ \: r1 G4 _+ R% s7 ~ - " }3 K0 P! ]; v6 O
- }
+ E6 B: ]' E9 Q; p% ] -
1 D1 o* ]; E r# p' g& y
. [/ V6 x+ J# K' L/ A- }& a5 D) p- J3 c+ W' U2 o. h
- catch(exception& ex)
$ C5 \1 a1 h+ R; G' c% [ - {
1 m) C2 G; o6 z0 z/ T - //---- Enter your exception handling code here -----' I$ ^* {% V3 C& o! {# Y
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
0 I9 g1 w$ Z6 D& R6 {2 l/ k - }
# ]4 p- {, T! w0 r7 t( B s - }
: ~+ I: `' P* A
复制代码 # k0 @0 h$ }1 e4 H
" B( B( [7 {& Y7 w- e6 u
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容. ` G9 X3 X. T t) v
& `/ b5 S, @2 H) f- |2 ]首先通过InsertColumn 定义列,有了列才能创建节点Node
2 s* d* K$ _ w+ A( N- p- b7 o: o. t" r5 n: k
这个顺序非常重要!
9 V! O# @4 v P+ m2 f+ T+ w' G1 v9 L
treelist 树控件创建
' c/ x* Y+ A) Q! C* _3 P5 i0 G2 [0 {* o2 E5 p
|
|