|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
) w& F# Z8 a( b W) Z- i: ` - {! ?8 R$ i& R- Y# T+ G
- try
$ H' [. b- T. {% ~ - {, n( ?8 A! t5 P- a. C( U
- //---- Enter your callback code here -----' k3 S9 M; \) U- ^
- 2 z- U" r) s% s; o8 f' H$ v7 o
-
7 b7 s9 z* R* j* X& Z2 {/ Z - tree_control0->InserTColumn(0,"Name",140);
( _0 k6 R: y1 r5 P - tree_control0->InsertColumn(1,"Feature Type",90);
. y5 O' K5 i0 g+ N/ f - tree_control0->InsertColumn(2," Up to Date",70);
; k- ?0 \% w6 g
0 m5 A% U! z/ {7 l) z" f0 N l- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);0 t* o) B: }& |
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);* E5 F5 G& P: s c
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
' [( ]4 N, g; m* r) \! e
Y" v; \: G7 u1 F" Q- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
: t! Q4 X1 ~" E - 4 I: Y+ h) o5 J/ J/ D$ n
- // create historymode
5 X9 q9 p+ p- t- q, D+ _ - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
- ]4 f4 j% k8 U7 J, O/ S - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
7 _; v$ G6 p: `+ e - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
# _4 T7 Y/ P9 x4 V" O - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);% p/ S2 ]: I# z& W9 T4 w3 F( \# k
- tree_control0->SetSortRootNodes(false);
' _8 {* y: x6 p$ _2 I- b2 k - modelhistoryNode->Expand(Node::ExpandOptionExpand);0 } u$ o1 x& Q
- // get all the features with values % g6 F4 ^0 ?% j5 D" K1 c3 e
- % W) }8 d4 a5 p* W
- std::vector <Features::Feature *> nodeFeatures = getfeatures();% q. v1 `5 U# \
- // insert the features
6 c* a+ G( @/ ~ - for(int i = 0 ; i < nodeFeatures.size();++i): `6 A2 `: l9 l% `0 o m6 A4 T3 W
- {
6 |, D% Z* r0 g" t: S - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
, V; y0 [) n( x3 ?$ q - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
# h) ]: y; l! u6 { - 6 G3 ^" ~; j! ^
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
8 M- h9 h7 e: {2 V. B6 J! K - featureNode->SetColumnDisplayText(2,"check");
; A/ p. n4 Q* A5 u& b3 l/ l/ J - ) G: K& u" X2 b5 Z3 o" [
- }" q! l3 W, |2 s- r
-
, b; O) C. q% {% Y6 _6 D
$ t) u& l2 C+ d7 r% S- }0 i# ?% W% g# |, @3 Y
- catch(exception& ex)
# y9 _ U" B3 b - {1 @% {: K1 J/ y7 Q
- //---- Enter your exception handling code here -----7 s4 K8 k9 |; N6 D
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());- ?3 Z" Y: I1 Z. ]
- }) H' _& a3 V) J) w
- }: M1 {3 u! B2 B4 O0 h- I' ]6 ?
复制代码
/ {# _8 g# x; _$ M0 u* Q8 t6 k- U, ]: B& g) \) S
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容+ L. @3 B+ O" P; P
$ M$ }/ y( E& z( n, g" Q' q: R
首先通过InsertColumn 定义列,有了列才能创建节点Node
0 T1 l( ~! W2 f* O; U2 Q- R0 L% u6 d
这个顺序非常重要!
' |- D: s9 i, a) [, l4 B, Q w
* y! p X: c7 @5 q- B. m
treelist 树控件创建
, x" K* V. s5 b% Q
( V1 {% k0 }0 v) u( J! p
|
|