|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb(). ]7 b, k$ }$ ?' ?: `. X
- {# H& l) R- B6 s$ f! n' y- x
- try
; s9 m$ Z' [) F9 \4 m0 Q/ v - {' {+ v0 k& C( m7 ?" z
- //---- Enter your callback code here -----
: S" W# U1 u2 \! J0 N - ! p' L+ z' R0 V; h* u0 h0 o
-
! g/ e3 ]. g W" H t9 e/ M - tree_control0->InserTColumn(0,"Name",140);
. Z, u* b' e% [- ^ y4 x. {7 a - tree_control0->InsertColumn(1,"Feature Type",90);- a$ {8 M# e: b* ]9 u
- tree_control0->InsertColumn(2," Up to Date",70);
/ }# j/ b' ^* @* I$ E( U - " J8 l7 v0 D: ^! o7 d. V. W* y
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);" B6 k3 ?& j+ T- c: \+ i) a
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);# M0 F Y" D4 q' G
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
/ C4 _& ?7 V& C- I3 ^9 R# } - V( k8 ~9 o: O
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
9 t- n+ b- a/ n0 G - 1 p. j2 w/ [4 ^) x2 G: Z
- // create historymode- }& Y4 x8 m3 p5 w: G, U6 u0 }' k
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
" d2 N3 D9 q4 N. ^+ L; N - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);$ p# C- v* l y; Z) h6 M7 P
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
0 ~. C- I. r ?( c: P5 Y4 e) H - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
: A4 o! u. y |- \ - tree_control0->SetSortRootNodes(false);* s5 a1 w0 E( O N9 U3 w" Z
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
! s* _1 g# @4 y5 s - // get all the features with values * @( [6 C- f, ~) o
- 2 f# {3 T6 P) W; Y1 L, A
- std::vector <Features::Feature *> nodeFeatures = getfeatures();
2 K" b1 U" @; e3 X+ U& b! J - // insert the features
4 t. K8 {7 p* O' U - for(int i = 0 ; i < nodeFeatures.size();++i)1 N9 H$ |" [3 e% [ {" A; O
- {3 y+ H- s' A) \# ~
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());) a. s5 o* A9 T; f8 z' ~" g; @7 J
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
" T- m# m" ?# W( d3 L3 B - ! p0 D% Q7 a) M1 m4 B8 @+ n" f7 L
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
( D% M& l/ V0 l8 S E( P - featureNode->SetColumnDisplayText(2,"check");
' G& ?1 w# M r& f3 e9 c6 J: Y- s3 t
6 S9 w: `, W$ J6 j g" V# I/ K- }' t. L% d4 C& R V
- o" |8 i( u# c6 R8 Z6 Y" ^) K% P
8 h$ q* {6 {/ ?" C( D- r- }' P( P9 s6 U0 ]- c4 k
- catch(exception& ex). p5 J& i9 Y- P# N; {+ r
- {
: {8 k: I" F' ~; g" ~1 s/ ? - //---- Enter your exception handling code here -----
( |2 N! t6 L8 }3 v4 M1 T3 w - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
: m8 A5 \. d( _3 m" |' u" h9 e - }& n3 K8 q# i u! y& N& S# ?
- }& t+ R% G- h7 h1 l; ?4 f9 B0 h
复制代码 5 ^8 f& A4 j5 ? _& J
3 g- f2 _1 T4 z5 u; z dtreelist的创建,需要在dialogShown_cb()里面定义treelist的内容
( a8 L! {+ ? A8 t
0 P" [1 p+ l# N' s# J, e+ y5 v首先通过InsertColumn 定义列,有了列才能创建节点Node
! d% a5 s" t# b$ T5 N4 z( B) l& h, H, h% r' ^- h! u+ _
这个顺序非常重要!
/ W) m; Z B0 a5 r! W# x5 }- ~; j: O" M" S. a
treelist 树控件创建
. t1 s0 s/ }5 M- ]7 R
2 U$ q9 w" z. g; \ |
|