|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()3 C3 W0 g) S4 X: B! X
- {
* v' F0 z: v0 ^ - try4 Z( H* F( h; C0 ]; O
- {
( O! ~+ B' z1 z) W3 b - //---- Enter your callback code here -----
& ^/ F; x9 `# c# s3 B i2 U - 5 E3 Y! J3 G9 ^5 S1 j
- 8 n1 V5 Y8 N' q2 Y
- tree_control0->InserTColumn(0,"Name",140);
8 e6 a; V8 k4 I* L' l) e - tree_control0->InsertColumn(1,"Feature Type",90);; i" m& u! t, M5 H# g& P/ e
- tree_control0->InsertColumn(2," Up to Date",70);8 ~3 @! I$ M, v$ J0 j, B9 }
- , g( q/ U; U5 ^0 d# [( D E6 E
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
4 V. d& t& x7 K3 u2 R4 o - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
$ {! P# P2 o$ l$ t: ?, h" H) Z! I' s9 B - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
3 K- [& h, z0 ?" D% s y
: k3 {: |$ i0 U& c# A- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);5 L, H, h9 c2 H
- 4 Y* M" O# C/ @$ Q2 e! |% }) B
- // create historymode
, r* z7 O: N/ N6 l - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);- `1 g% k- Q2 L- R
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
7 J! @" t0 D1 m+ H( ] - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
; o4 V0 b+ h* v- d4 y - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
1 Z) ^% n4 L( S( Q g - tree_control0->SetSortRootNodes(false);3 [7 N$ X/ s2 Q0 t$ P5 _- B
- modelhistoryNode->Expand(Node::ExpandOptionExpand);; t0 u4 \$ d+ q
- // get all the features with values
: m2 r' V; f2 f; h- H6 M# ^9 U
* h$ X4 h) V7 k- std::vector <Features::Feature *> nodeFeatures = getfeatures();
0 e5 e7 s7 k, w5 \6 V& r8 |( A% n- ^) S2 M - // insert the features6 u" O; w2 F4 B: o' ^& {) [- O
- for(int i = 0 ; i < nodeFeatures.size();++i)5 `$ ?: e" \ K8 t1 l3 S: U5 f
- {
4 r/ K0 Y* l5 z- p5 ~ - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
) ^; c" P$ x) [: j' P! Q0 W9 Z- l - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
) |8 W, v0 J7 Q4 M, n, A: U -
- J: C5 T1 e7 r( D5 |4 V+ x2 | - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());2 `# v' C& L- q
- featureNode->SetColumnDisplayText(2,"check");' b! b% F, e5 \; u. W
0 L% I% h; T3 o3 \' A5 h5 g- }" G& H1 z7 P7 ~% o8 n
-
) w( A( N2 _& E7 O6 J
# q" T- v" H& t$ Y- }$ x+ @4 G# M# H- u1 e) h+ l
- catch(exception& ex)
! d- G" U3 q- U3 F3 i. } - {
; }. N$ B6 D6 y - //---- Enter your exception handling code here -----
, h s5 s8 z! d! s3 F0 o- ?0 q) l - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());' o8 t: |; {, }
- }
2 ~1 O) o6 b5 l+ B! z( q - }
$ D |6 P2 p) y8 t! |
复制代码
5 w7 K0 Z \' j
* u) E/ M; `5 ]0 rtreelist的创建,需要在dialogShown_cb()里面定义treelist的内容0 O w* @( d2 d4 a2 e: M8 U
; y- j/ y' e, t/ f6 K首先通过InsertColumn 定义列,有了列才能创建节点Node
+ d! g- W. [; C' y `% u( Q/ w q g
这个顺序非常重要!* O) I6 ^& _, u. H3 z
/ ^- v1 ]) C( R; p/ p' X
treelist 树控件创建
7 Y0 ~/ `. Q# ^- }/ E1 {
. \% d8 s& z! P' a9 d |
|