|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
; b9 i% ~/ C) W# D - {
5 a- d' I2 o2 d ^' l - try
$ u) }4 L6 B7 M% V - {
9 N( {: Z2 f$ u/ j - //---- Enter your callback code here -----
/ Q1 }) ^! }& u4 h: A
+ K8 Z( `% N$ X c+ t9 g- 1 ~; O9 y0 m+ u/ b
- tree_control0->InserTColumn(0,"Name",140);! e9 H8 A! S/ E& ]5 p
- tree_control0->InsertColumn(1,"Feature Type",90);
8 m% f! c3 U% _5 |2 Z - tree_control0->InsertColumn(2," Up to Date",70);6 z/ [0 I0 d+ P7 E- T5 S- r
" s5 {3 M& L$ ~, J- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
: s2 i, u7 [8 J: [$ K. d1 | - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);( l k# G6 X& _# K) S
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
5 t) x7 M5 a4 V0 |& B) f - $ R+ Y$ T! g4 z, C& u) L B
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);0 v$ c+ T; d& u: o
- ) q- G+ H, [8 p7 P4 k, R7 r9 r
- // create historymode* f3 L8 L/ u/ L. ~
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);; @$ T+ c, |- Y* i
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
% v: k% z; s/ j8 f2 b$ _ - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);1 J0 {9 s2 c, A$ q% _
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);6 r' O& @" s) x& F. z$ V
- tree_control0->SetSortRootNodes(false);
2 n! W$ x3 j, ]' t# f - modelhistoryNode->Expand(Node::ExpandOptionExpand);
* o4 U3 g7 Z2 G* o' ^8 V- ?2 v - // get all the features with values 0 u- o% h+ Z9 _4 i
- & d! y* x" {6 ?$ V6 \+ F2 x
- std::vector <Features::Feature *> nodeFeatures = getfeatures();7 F( q4 Y' \* N8 m$ W
- // insert the features+ c' r' I7 O! c9 R
- for(int i = 0 ; i < nodeFeatures.size();++i)) t8 O( g) r; F, N
- {
/ P: v$ y' N" t! A3 U b# i - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
; {4 m7 L, f: \; A - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);7 t- g: v, L: v' Y6 L
-
( @: W+ y+ a# O/ D1 |( x3 ~ - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());0 ?! d; x$ n3 `& R
- featureNode->SetColumnDisplayText(2,"check");
8 D! a# v5 w7 P$ t
: r4 p) \( ~. |5 R' L* u- } [, _9 r8 T: @) Y) C F( ], @
- . S% ?+ J4 ?( Y+ r7 j8 a- o2 D
- " N5 T5 Z! G$ C
- }
+ s; p) m1 S) c8 ~+ Q - catch(exception& ex)
) P4 ]* {" ~- Y7 E( v, E - {
! \. @9 J C. e5 @ - //---- Enter your exception handling code here -----, ?; t: }9 K) d% @, G
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());$ E8 p4 q( W$ }! v* f" ? B
- }
% P7 c+ V4 n2 C - }* l1 D" e# v! \6 N" W
复制代码
3 u) v) l4 u2 x- o' E/ {* v8 F* A9 ]# X9 }) d2 M# t# R5 W
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容) c5 x1 t9 V. b
4 F& t+ l6 t0 h2 E2 ~0 Q0 t1 I首先通过InsertColumn 定义列,有了列才能创建节点Node
$ E0 g2 l6 F, `: l6 w: h- T0 p! Z7 U. t. H
这个顺序非常重要!3 U6 r5 g0 D0 z
4 C" u2 h2 c/ B3 U7 S/ S: \4 Q
treelist 树控件创建
1 H0 i/ j+ k, A$ y; i8 @/ W: W+ b1 X) w, H: e n+ _' W
|
|