|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
* V, U$ I. p% T - {
; y8 {/ y$ r, a, R! l. a - try7 }& D- s9 \; _4 h' q+ l5 @2 C
- {
( y+ }% S$ y& y7 V; D* W - //---- Enter your callback code here -----8 [- t" s" Y+ l- N- p! p
- " E/ b3 U9 U2 B& g* l/ G
- : \3 L4 e# ?2 g8 @
- tree_control0->InserTColumn(0,"Name",140);
8 i: l0 K. u3 ] Y8 R; b - tree_control0->InsertColumn(1,"Feature Type",90);
* v- M2 n2 u2 Q( z4 Q5 _6 t - tree_control0->InsertColumn(2," Up to Date",70);
, l$ O( W' M; ?# E, t. b
5 a! T6 W' |3 M; N* e- k- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);
4 f8 L6 |: J. |: K - tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
- J- M, A& x9 i# X" R w+ Q% S( k - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);* m* a( j$ L+ w
- 5 s0 @0 w1 j2 R D
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);, G0 K( S7 ~# J
- 2 f6 d1 T, `5 X- J0 }3 u
- // create historymode8 \3 B* Z7 S) S( i" G: S
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);( C+ L1 t% T! D5 U
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
1 d# G1 R* U$ ^- g5 J+ ? - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
; c4 i& K7 \/ l - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);+ Z. ]; _$ t' q
- tree_control0->SetSortRootNodes(false);
& e* G7 i2 z, R - modelhistoryNode->Expand(Node::ExpandOptionExpand);+ ^0 r2 y B. i; V7 q- ^# y x
- // get all the features with values 2 h( e4 U% P1 k3 O. t
1 \- `0 v6 I- o) \- std::vector <Features::Feature *> nodeFeatures = getfeatures();3 q. i7 B8 t2 o" X& [: \
- // insert the features
3 e W7 [, t3 S - for(int i = 0 ; i < nodeFeatures.size();++i)
, J' ]! A) [; H& X - { O5 D2 S2 [; M% r2 |9 ]
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
" F) d( c/ X3 e f# o - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);' r' c" u( |. B% _# k
-
; R" f2 H/ {1 }3 v6 T3 d( z - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());' d. M; J( ]9 m& Y
- featureNode->SetColumnDisplayText(2,"check");; D2 U" s# n( P3 @9 E
2 b0 o4 j! k$ x$ J$ F- }
8 q+ \- |' A- V. \ - 4 Y8 a8 P/ J b2 d% W6 y
, c+ J# I$ i+ e& |- }6 h+ A5 [; {% a
- catch(exception& ex)
5 ]+ ?) M3 b4 ?$ c - {" Y2 }6 F8 G9 d2 p
- //---- Enter your exception handling code here -----& p- {. u* L0 `6 I# v& z
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
! o$ L+ v; W% [$ a: A/ c! A - }
. c; F8 _9 f' s$ _6 W% J - }9 O! k6 E5 ]4 y
复制代码 # j* P8 C- q5 {+ N7 I- T
* T$ A* Y0 b9 ] A, U8 n1 U
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
5 t5 K; C0 K9 M) ~! h
8 p4 y1 X& Q+ a# g. |% v( G首先通过InsertColumn 定义列,有了列才能创建节点Node3 d* m. C+ T$ z4 v9 f1 Z
. |3 }, r, x# M, b c e* ^这个顺序非常重要!
7 j! L( h. w0 U6 T
$ u7 D! Q$ \$ j# U7 B5 s
treelist 树控件创建
; @8 h, x1 f8 j/ S% `# E9 z
0 M0 ]' y1 T$ R9 ?% d |
|