|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()' i _5 o/ A# z0 e
- {
1 [5 _ R( Y8 k, v - try1 t! L- b& @1 H& y+ a
- {' ]5 A, I: f! f0 h5 l* a- r
- //---- Enter your callback code here -----0 D2 v# u Q# h0 l6 a
- ; F3 i2 c" M5 X2 i1 {
-
. D' ~: r q- z4 D* i% {4 w - tree_control0->InserTColumn(0,"Name",140);/ v5 S9 v9 V' b
- tree_control0->InsertColumn(1,"Feature Type",90);
% b3 r: l; o# k4 \; } - tree_control0->InsertColumn(2," Up to Date",70);) \1 T2 ^* Z; i
- ' j. g$ k: c" _9 U
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
. X6 | E) |6 a9 c$ u) ^+ F# d - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
' X5 E9 F3 F1 R m6 `4 Q7 J3 C% R1 i - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
. t Z$ ~3 w0 s0 W- p m5 _( Y5 O - . f ? ^; O$ |/ s& l+ ]( G0 K
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);2 }" r% [# z# S
1 p6 m; I5 x& o% L: O- // create historymode
' Q9 e- X3 `) P9 \ - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
4 X8 {1 M. n' w - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
, [0 P% p @! I2 S% ` - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
! t: A3 g$ O% Z( C - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);& x1 `. ~: e: k
- tree_control0->SetSortRootNodes(false);" P, w6 ~( N' n5 o; a% q+ h) |; {
- modelhistoryNode->Expand(Node::ExpandOptionExpand);( y! k( Q% J* N1 ^( a9 F
- // get all the features with values ; w) c; `: j3 F% l, {+ F
- ( G* S9 t M& p$ k- ~
- std::vector <Features::Feature *> nodeFeatures = getfeatures();& |: Q% f4 T; E& H
- // insert the features
$ U, c# s/ b# a: v; T - for(int i = 0 ; i < nodeFeatures.size();++i)7 p* j$ I) x d& R& F% C! A4 Z9 I3 Q
- {
2 F, M1 j' ]1 W! u - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
# L) ~) f5 m* `) W# p2 o - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);. z, R1 h- ~( f. `4 Z7 J
-
9 u( H/ k1 N) a* j3 ~1 M1 f( Y - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
5 v4 x% N4 ^# C+ |: D. g - featureNode->SetColumnDisplayText(2,"check");
# M I1 }: P- U9 s6 ]" `
- j" C; |* u: c1 x3 R% R- }2 P {! I [, s1 r- W
- % g1 [; o$ O$ P" v( t9 K
$ H& P2 A% I- b! A ~- } H: s+ E* G6 b* Z
- catch(exception& ex)/ J% V+ `/ a. | g
- {
# f! w, L* }' V - //---- Enter your exception handling code here -----. Z0 q: L4 s# G& n- ~, _/ f
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());$ b! C- Y' X/ r) L& k) E6 W- K$ u& m
- }
/ Y0 A9 i' I( I' d' _6 c& i* ^8 p - }) ]+ C. M, {9 }( K6 ?' i
复制代码
& M* C, ?4 J' F- k/ ~' L
9 q7 m' Y Z' l' d+ ttreelist的创建,需要在dialogShown_cb()里面定义treelist的内容
* p. _+ |- U2 b6 p' q! D1 n( q1 Z* V8 U/ A. v
首先通过InsertColumn 定义列,有了列才能创建节点Node. W6 d+ n9 V7 ^7 `+ _( N
/ Q4 K7 R9 T5 V* M5 J
这个顺序非常重要!
8 Y1 M. J o8 i f8 c# e) q: { l( ]; V1 V" V, O
treelist 树控件创建
7 e+ Z* d8 B5 w; o+ Y- @+ }" p
8 U9 J: ~( e9 {& w0 C0 n8 s
|
|