|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
0 `% a- J& g8 u1 a a5 Y - {3 a* F% v s9 G) T1 k+ ^5 D
- try& ^. V6 {4 t5 P
- {$ F% U9 a: z5 @
- //---- Enter your callback code here -----% D! E$ e- |7 [3 {" j$ t
- 2 [" k8 ?: u j4 K
-
$ M, m! u3 J: h& s+ p - tree_control0->InserTColumn(0,"Name",140);
. C5 g) ?' o* E$ C4 ?( T9 D7 d+ R1 r - tree_control0->InsertColumn(1,"Feature Type",90);: _3 O+ f* M8 d0 p, w# p" P
- tree_control0->InsertColumn(2," Up to Date",70);# `% G% q! [! H* `8 `
- : ^6 P3 l; m2 y
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
2 s. R. I7 o, U - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
" Y& T" v( n1 \; @ Z; N* h0 x - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
# L! v( x9 r$ { - / D6 J6 k7 y* o9 a5 F8 O
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);( T+ M# W# J9 f: K
- ( U6 T, U/ ~' H& F3 B/ X1 y
- // create historymode* J( o f3 X/ x, V6 V: A: }+ \
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);8 }# O4 m- ?$ `
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);" t8 t# d! A' J5 N; n9 ?
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);# O. D0 q% ^: `5 ~4 m# V
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
' ~ p4 t! l q$ Q - tree_control0->SetSortRootNodes(false);7 r, m, `3 ]' e
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
" Z4 f0 {! P9 l: a- }/ L - // get all the features with values
: e# ?) v! B& |4 b0 V2 A; l# y - " I/ G9 o4 f3 e7 {7 d3 W# U2 Z2 e- H
- std::vector <Features::Feature *> nodeFeatures = getfeatures();6 y- c; m4 C, b+ X* R" q- {
- // insert the features
% O& w7 d, f2 J+ s: b. f/ x - for(int i = 0 ; i < nodeFeatures.size();++i)
; y3 J" J# @ u T) Q - {
0 o, _$ f% R7 L - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
; F4 {5 z7 ?0 { - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
. i& I, e& N+ P! M' q: ~4 J, i; \ -
% [& a) B0 _! [: w A+ i% M( u - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
4 ~, K& h s, n& T; J1 w - featureNode->SetColumnDisplayText(2,"check");
! p& u. L1 _" b2 {) { - ! q! @8 Z: {2 U
- }
+ U7 x- _7 ]; w8 y; B - 2 H& f7 L h3 [1 v5 |, f" _9 C" k% `
- # M6 Q8 ?: Q' m, L* e( j7 z
- }
4 Z5 D# D S1 e& }, `6 k1 r) H - catch(exception& ex)
$ {( A. [% E6 P6 O4 p4 d# P( l( Q6 C - {. N4 Z: C! T: Z* Q) j$ _1 W) @
- //---- Enter your exception handling code here -----; z& q o- z$ o) o0 G+ W
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());. Y$ V0 G: ~0 o$ a+ D
- }, F* D5 w* o# X4 p
- }0 F5 c5 ?8 O. ]" L& i! o# R
复制代码 ( W, f; m+ _/ r( C. i
! B) |2 ^5 N* n6 h9 y( Htreelist的创建,需要在dialogShown_cb()里面定义treelist的内容2 v% V8 d/ ~8 M$ ^7 v- S" a. R
1 p$ c$ m7 x; ]7 A/ M8 k& M9 e首先通过InsertColumn 定义列,有了列才能创建节点Node
' P7 H' k: l& P& l) e4 _3 b' _- l' w
这个顺序非常重要!
J1 _1 D. N% _; Q: z/ h# w
% c* D& Y/ |5 s2 r; J9 V; a3 j( {
treelist 树控件创建
9 s- {1 P. j! h
( m4 q6 V) N: H ]) A: e6 |. o
|
|