|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()3 ?1 h& e& q1 q7 [! ]2 x
- {, ]' D) [% N" U$ Y4 s
- try( B/ b# v" e& J& w& l y1 p( `
- {! v6 ~! i& T$ Y1 P$ @; T! F
- //---- Enter your callback code here ------ H* m" G" Z% { _' t' T2 g& [
9 T; w0 x, ~/ s# P8 ^" h6 z ^-
$ k4 R( @+ w; J - tree_control0->InserTColumn(0,"Name",140);
9 M: Y3 H7 z7 ^2 C6 _ - tree_control0->InsertColumn(1,"Feature Type",90);
) e1 a; F( C$ l8 L) k# V; r" A - tree_control0->InsertColumn(2," Up to Date",70);
1 B# R8 y i* s* M9 a5 o/ ?
9 r# u( \! n! n6 |5 j- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
# D: \+ p- ]" k - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
3 i3 { N6 \/ Q( a( _$ H3 T - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);( l1 @0 F/ r' f, X# E7 g/ a3 ?6 i
- \8 A8 w* v3 {1 B1 e) Z ]
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
. s& [, N& Y$ I& V9 ?0 O
0 }1 F4 H# n( c2 ~( D- // create historymode2 d1 N, j3 D) w4 ~6 g2 a+ K
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
/ j# `( Z( t2 Y' K9 q ?$ ^/ ` - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
1 r0 U h% ^$ N. ` - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);4 G% j8 [# @" N0 T9 O, L
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);+ g& P. ]& d: X) _
- tree_control0->SetSortRootNodes(false);( X; ~. M6 Z! @/ [4 J% r9 q, M
- modelhistoryNode->Expand(Node::ExpandOptionExpand);* z& b# o( ~7 h% \1 n
- // get all the features with values
! e: i5 j. o: w) \. K. ] - ; k! I5 n6 j! x' q6 c, q2 V
- std::vector <Features::Feature *> nodeFeatures = getfeatures();% a( {. Z& r/ E3 k/ w
- // insert the features- z$ l$ _5 q* |' u' ~7 y8 M
- for(int i = 0 ; i < nodeFeatures.size();++i)
6 P& D8 Y, w" Q - {
0 J* d* b( `7 ~2 V - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
% c! b7 F$ s9 o$ _/ Z7 f - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
; a% S1 l5 p7 a& X0 y -
1 s8 l$ E* W7 m! w7 l6 @1 n' ] - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
7 u1 @: G4 K8 F8 X; b - featureNode->SetColumnDisplayText(2,"check");. q$ f1 ?6 |- C: s$ i/ U! g3 p
- ; ?* D5 |/ G0 P( J, Q
- }$ |8 C( ?5 q# a# U3 c4 I5 Z. \
- x3 @; e, s A
* \: t* h3 Q, E2 V: W" S% @9 k- }
! |3 _' k) f0 p, T; i2 y! t - catch(exception& ex), {7 ~5 H+ R, R: U+ k q0 L
- {" I/ X$ W, H" `' L
- //---- Enter your exception handling code here -----& I0 z# @! H0 o' K
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());& P$ _* [" Y+ t2 S7 T; ?7 i
- }
" J4 ?0 G$ }2 h6 i: r5 Y0 U% Q; H- o - }
* W. u9 b* O I; R: G# l& q
复制代码
) m0 H x1 S2 x Q/ J2 ~* M' n! n5 p& j- e$ V
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
5 v! i: S8 \8 R2 Z" q: N" \
% q! ~ X; c5 q ]首先通过InsertColumn 定义列,有了列才能创建节点Node M8 W2 D8 h+ ]; T; G; w# q3 [! ~% W
5 G: p; c4 ]% K这个顺序非常重要!0 e9 I7 t& B5 x8 X7 ]" `0 W/ Q
' |1 x! ~8 K5 h/ q9 m' z
treelist 树控件创建
, H7 l Y! c, ^+ g' M( @
$ v- j! ?7 L& J8 x' I/ w |
|