|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
6 R% b5 X [; N* q, `0 \9 ? - {% d0 e5 [% N( M1 w, O1 V
- try
, N% X1 c9 u9 H2 q - {
, q7 Z3 R" A. ` - //---- Enter your callback code here -----
6 R# _, n4 w: x, E - 6 A0 P1 `( `- X+ w
-
Y/ k3 t! p- V M5 ^3 H2 M4 u! Z: X - tree_control0->InserTColumn(0,"Name",140);
: a9 k0 B( P/ C+ H - tree_control0->InsertColumn(1,"Feature Type",90);
. c6 f: A6 D! q6 H - tree_control0->InsertColumn(2," Up to Date",70);: d; m+ S; }0 I; x5 o' Q, z+ A, J
, K5 a6 I4 d) e- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);7 A8 m6 s+ V) `) W/ [7 K
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
& k9 {( M* @* E7 x9 B/ l9 a! t - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);0 I/ \; I( R. G
/ g+ {- W) ~6 y# I# G- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);8 ]% |9 B; j/ M% k' Z3 `; `
1 h/ ?5 f( @3 Y1 ~ v* T# P9 W7 u- // create historymode
" G, ^6 P l6 L - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);: d# D6 Y D0 w' s& b
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);9 ~# p& f; O' u3 q: j1 a) L- |
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
& ]0 Z$ C. Q( e) j% ^0 `! t - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
5 w6 h+ }* g: l7 B; f: v - tree_control0->SetSortRootNodes(false);! U9 z( y" ?, a4 \3 d1 v9 [. ]
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
8 x* a! i# [: O8 F+ r - // get all the features with values
0 c7 Y+ O# P5 U3 p8 ~7 y) s - # d8 y z- d+ m: z1 j: m, r
- std::vector <Features::Feature *> nodeFeatures = getfeatures();$ ~; }$ g6 D3 H9 B0 g6 [0 I( Y1 H
- // insert the features- K8 c4 @5 t- T, [
- for(int i = 0 ; i < nodeFeatures.size();++i)" i) f. l2 [+ _
- {, d) e+ g! T1 q4 T1 o* f1 z* b
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
# n4 O. n" v+ q# G3 D4 X2 Z - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);! h, E6 |3 p% [8 ] I! |# H
- 8 x2 n( g( e: |2 A$ ^
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());' U3 Q8 O R' G+ }5 o4 @9 B) G
- featureNode->SetColumnDisplayText(2,"check");
; S1 J8 x6 e7 X4 v5 r, p2 v
! O n8 b8 p; ^9 Q: t N- }- F/ r G* l" h+ }# i
- ; B s$ m0 J7 L3 z5 w! R. ^& P
8 Q6 A5 |9 s, v: W: h# n1 `' M- }+ F7 {+ W% A% S" H. _! i! B
- catch(exception& ex)5 Y I4 r" @# \: D7 D8 M2 o
- {
7 L7 c4 p! z% v" J! j% S - //---- Enter your exception handling code here -----
2 A% R- z: ^0 c" D4 y' @& n - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
! R: P, D; a; t - }
' d! d/ ~1 [0 M) H G+ y, T - }
: f7 r' K8 x% z. i3 d! I" X! W
复制代码
* `, N8 \/ j& ?0 ^2 Z- o( }8 g, L0 r1 G0 M8 W) F( C' X+ U: l
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容! v1 \! j( i6 J" w8 T$ k
! s& M9 W; H6 n. q+ T
首先通过InsertColumn 定义列,有了列才能创建节点Node; L' q8 [% D" |3 \# l' ]+ J
. X, F( T6 K3 H这个顺序非常重要!
* `% U$ ~, ^! V; q; w7 _7 a( L& ?* E, v1 `
treelist 树控件创建
0 v9 F. l: D8 z1 I( S* }( L
# j* `, {, I- J |
|