|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()# O; p- [; V3 u+ ?& A# ?
- {; [1 C6 F6 X, Y, n {
- try, q: ^6 A5 _( B& c5 ?, n
- {/ Q d7 v& N7 `$ ~
- //---- Enter your callback code here -----
/ @# b5 {- j( H w( ?
/ L& [& P1 G" n8 a3 i-
# ~9 g! @; G' T3 e) j4 w! C - tree_control0->InserTColumn(0,"Name",140);( ~8 c/ U, D: D) o9 p; o% U$ g
- tree_control0->InsertColumn(1,"Feature Type",90);
5 K% D$ X/ J( y - tree_control0->InsertColumn(2," Up to Date",70);% F# v* |% s( S& D9 p
; L- @9 \, x$ M- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);7 E) d' A$ q" O. |, G
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth); E( G; }5 z% ?; C9 e( P b
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
6 t2 j, k" F- i7 N: L- N
! u8 @$ z: q: N" O# p- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);3 Q( [8 w( P: b( J5 M7 ~
- , D4 ^3 q6 k6 r; e5 h! b
- // create historymode
+ [! m% T: T# G7 U" [ - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);9 O# n6 {* d: E9 S8 D& D
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);$ k$ c/ j1 V* I; `* Z# R* ?
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);+ g) L. U% g! b- G9 X
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);" O, O t1 g! M4 k
- tree_control0->SetSortRootNodes(false);1 J7 r8 }. g. T2 K6 q) T4 l4 o9 X
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
( K, [) m0 d( ]- k/ C! d - // get all the features with values 5 w5 ^+ z' Q3 x \' a/ \* P
* |& J+ a; H3 J( Y/ i- std::vector <Features::Feature *> nodeFeatures = getfeatures();
+ o8 ]7 f8 ]! d3 ^/ O8 o! z j; M - // insert the features6 u4 b/ w) X0 E2 E
- for(int i = 0 ; i < nodeFeatures.size();++i)' g& [7 d* O- r# ?1 L5 b
- {0 R5 M4 `- }' y1 N$ s
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
_' }6 @6 o3 v$ I& t0 R Y - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
9 X, C( k; U2 Y _9 e. j q -
( f y; g9 D/ E9 E) L - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());$ U5 [0 ?- L7 P/ p
- featureNode->SetColumnDisplayText(2,"check");
/ h# ^0 N* J$ b0 k0 E+ D
; L& s7 ?. D6 b- Q. m- }5 y3 T1 O7 R# ~+ `+ f6 s
-
; k& I; s' r$ l. m
( e# D0 w N" ^9 F- }
# [8 ^! K5 |$ L# D( C' R - catch(exception& ex)# e6 z: V4 Q! U* ?* f* ?) s' d
- {
+ T+ }9 y( N7 @: T - //---- Enter your exception handling code here -----
! Z/ f0 g/ H4 q+ u) w - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());$ \6 V" V! o9 L, V
- }
. e& U& _- c. S1 J6 e - }
( s+ q' D8 k5 [
复制代码 ! J" H9 V' i& d' V" j
6 |# Q0 x& q8 otreelist的创建,需要在dialogShown_cb()里面定义treelist的内容6 x( i7 E3 K4 y5 o# `: W7 G
b0 L3 o, d$ H4 C3 L首先通过InsertColumn 定义列,有了列才能创建节点Node0 h' U& ~$ c4 _8 E5 ~+ a& I* J
+ }$ Z( N/ @4 r; p! _1 g9 b# h
这个顺序非常重要!
5 z/ }% |9 q+ r5 b& b# s/ c
7 ^8 L. A' }5 g* ~ c6 I' K/ ^
treelist 树控件创建
& [! v" [ S, s `& ^: Q
% L0 u* _ k- v* f |
|