|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
5 o& G9 W4 `$ I, Q; ], l) i0 n( g: H - {
. h+ p( \1 u9 v) Z* c - try# O; Y) u5 `- v* e M E
- {
# Y' O/ B9 w a% u) [. p - //---- Enter your callback code here -----* S& t" a1 X" ^6 u- U% L
7 V) e7 a, P( }! h) n6 [$ K( |- ( w( D$ o# }- |6 _% V
- tree_control0->InserTColumn(0,"Name",140);0 f+ h/ w+ |$ w( l6 V
- tree_control0->InsertColumn(1,"Feature Type",90); X* H/ P/ p: z' l
- tree_control0->InsertColumn(2," Up to Date",70);, G/ P$ _6 B; U' |2 N/ v% r
+ u) ~% N* l! Y8 y- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
: P5 q( v6 U- J H - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);- y& j/ i, I9 ^- w
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);7 C( J8 \0 L0 l4 [, v: ~% O: Z8 J
- 9 ~0 U. T6 u% G
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);0 M. p; [& z; W( h6 g
g' \6 `% F' U t1 z- // create historymode) U/ R P; U1 H$ p6 w
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);9 D3 z7 Y2 O8 d: n7 U L
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
2 P: V$ M D. r. a: {1 ^) E0 B2 x - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);; ]% R! M, z* O# Z
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
- X( z( p5 O0 B: x5 r2 f; j' @ - tree_control0->SetSortRootNodes(false);: L. }# i b# {1 f5 N
- modelhistoryNode->Expand(Node::ExpandOptionExpand);4 A4 _' _- J. A. V6 W L0 |
- // get all the features with values
9 f- q' D% l/ ]/ h5 {3 k1 X - ' h8 f& I+ Y& j& s/ ~1 O
- std::vector <Features::Feature *> nodeFeatures = getfeatures();/ _" M- ^9 h2 o$ ?
- // insert the features
: H# ~6 r U8 B' v; I+ X5 z8 Z$ p - for(int i = 0 ; i < nodeFeatures.size();++i)" n7 a: M; O/ b# E& `" U* N
- {4 O7 H1 ^5 A: I! U* Q
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());- \/ R" X8 z& Z" \: z! |! c* w3 L
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);. y( q p" R$ B4 [" R
-
9 H+ c3 t; L6 C - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());# K) a2 s, c. u% A
- featureNode->SetColumnDisplayText(2,"check");( Z0 A! r2 Z5 r9 R( M3 t
+ G) I0 |. W) k3 k4 {, n* A- }9 a% X& D" [# J0 b0 W
-
' b! |: _ N3 @4 ~8 ^( c
2 _! T0 I, L$ d1 a- }
l+ ?5 q6 ?! L - catch(exception& ex)% k, V: R Z0 |1 O' D; y c, t* Y6 J) V3 l
- {/ v) J% Q$ _ \% A7 z
- //---- Enter your exception handling code here -----3 L/ V, ?3 J6 ?# s6 n
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());/ O6 U/ ?4 u: i9 d! K
- }: E1 N+ b( t! G0 Q, O' N
- }
# Q$ l3 \$ t U& X8 o
复制代码
+ q; M' h' J2 }3 z4 e( k3 l) y0 I
/ j- |8 P. y# \+ n1 m9 dtreelist的创建,需要在dialogShown_cb()里面定义treelist的内容
3 |8 u* x7 V6 ], u/ j
& c# K8 c8 z: f. f4 o; `首先通过InsertColumn 定义列,有了列才能创建节点Node2 [$ I- W( F" P: Q& {) |
' m# W% X; a0 O+ [- o, ]这个顺序非常重要!: m4 n4 S; o" N/ E
- F8 O2 C" u+ i. i
treelist 树控件创建
) ^ N( d1 q& ^9 F
, j: A3 H( ]3 ^ q; O |
|