|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
+ d3 ?3 K; `* j, u1 j" T - {
6 P+ ^( S# d5 D4 ], y: Z - try: w/ m' C, v: Z, x! g3 `$ \
- {: N5 v0 x | `* p! E& `, M; h
- //---- Enter your callback code here -----( r- A" e( v I4 S" x H" M
- & ]/ H3 X4 t# e6 s
- ) h. }/ i0 d* t
- tree_control0->InserTColumn(0,"Name",140);
; M, |* u, `7 c - tree_control0->InsertColumn(1,"Feature Type",90);& a( r' r; p5 f# G0 X9 F7 h
- tree_control0->InsertColumn(2," Up to Date",70);
" l2 K, j8 B/ ~4 X% {' W5 t* Y
G3 v# |( n; y& v5 ]0 K1 b- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
# h7 U, d/ m2 D$ B6 } - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
3 [; W9 {: C1 h8 D8 u" n- r) K - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
- t9 r4 u+ u" k ^* {# q0 u3 c
- p6 P7 o* ~# D( v' J- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);6 I- x- j( Y5 v1 \& A% `8 N
- 9 [9 c- W. U% g0 F/ g! s
- // create historymode, A. H9 m+ D0 h; `/ \+ [% j, L" {
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);1 l+ D4 v8 E4 J x' \* x
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
M( y' N$ i: R+ M - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
6 v, h0 c; b( M3 p - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);" s2 W) i& r2 l7 `! v, d2 ]
- tree_control0->SetSortRootNodes(false);
# U% s6 Z- t5 ]! ]: k) e) E ]' z - modelhistoryNode->Expand(Node::ExpandOptionExpand);" L" B. J- l$ I( S! U
- // get all the features with values
X/ @1 ]& S& d7 _3 ]$ y - 5 i' c$ c p0 X7 [# E
- std::vector <Features::Feature *> nodeFeatures = getfeatures();
3 [+ b4 a4 {* Q' u/ T, q" ^ - // insert the features% u( @6 j- Z: w' F, b
- for(int i = 0 ; i < nodeFeatures.size();++i)2 @3 D( e/ H# B. k# M4 ~; `! L6 g# W( ~
- {6 g3 z& L4 c9 ]/ }& _6 f2 q
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());: l: a f: F$ [3 G' w+ E Y8 Z
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);3 f3 S, r, g# M% T( e6 \; a0 t
- K1 W6 S8 u2 g( g: x
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
! h6 o7 t1 D$ @2 e- z - featureNode->SetColumnDisplayText(2,"check");
7 R* j+ P* F6 L4 a/ d
: a! a+ F' ?$ W9 t& G- }
% X; _' K3 x, a# ~0 v9 A4 A6 o - ' v C, w. S4 x& E3 E
) D+ k, N2 S) t- }% o9 m' e$ i7 Z
- catch(exception& ex)
, H* n0 J% V# _( C$ R - {
5 r* [$ v! ~* }3 S6 b - //---- Enter your exception handling code here -----
c X3 ^+ x' v/ E - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());0 _+ \- e! v. n% T, e3 J: l7 [
- }1 P+ M/ ~3 V1 {9 T1 `2 G
- }
$ {- j/ z J8 x5 x w
复制代码 - @2 o! W1 z7 b+ `
1 n' e6 E3 j6 g( a; [8 ltreelist的创建,需要在dialogShown_cb()里面定义treelist的内容
. w5 U! |( m) v9 Q0 L% h( Q$ y8 x) G3 I2 H1 w2 A
首先通过InsertColumn 定义列,有了列才能创建节点Node
4 a( R3 Y! q5 J2 R
' K- n/ `4 c% r1 q! i3 t这个顺序非常重要!
" x- i/ W) t7 A% H" E
z& X. u! b- s7 t; O0 i
treelist 树控件创建
1 Y/ G) N5 l2 @; w8 C7 D) ~2 e6 C4 o* L3 q' G" J
|
|