|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
$ ^! w8 T# L. b4 G/ Z; ~* s - {0 m6 [' C. j. c
- try5 O4 c8 o+ j( z5 X" V# b
- {
+ A( u; N2 i& E - //---- Enter your callback code here -----3 V3 W. y0 a3 h* n; E
0 L- x! M/ |% {$ `! O2 l+ s- - P+ b \ d0 G0 ]# l" W) P
- tree_control0->InserTColumn(0,"Name",140);' \# N" S/ O" c- K. W, Q
- tree_control0->InsertColumn(1,"Feature Type",90);8 f$ O8 e1 L, y+ L* f) j- b
- tree_control0->InsertColumn(2," Up to Date",70);: V& U# y/ U# L6 ^# Z
- 6 Q! A: q9 |8 G# C" m9 V
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);' D2 J$ L* e1 @$ ]0 k" E
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);/ O0 G* G% G/ R
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);; |/ \0 M! L) ~, r9 c' I
; s F9 H2 M/ @, v% s" f- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
& [6 ^, H5 r$ s) g7 W
( w! @: p, o0 d2 G/ X: T- // create historymode
! {2 x0 m( E: T) d% w - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
0 ]( t# N" J5 e$ w* e: t) {& z: y% s - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);# R7 K2 U/ X' z8 y# m1 h$ B
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);
+ x5 m- Y- | X7 I- |# Z: F" J( a3 V - modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);/ H- k D% D$ q5 A( r1 d2 ~
- tree_control0->SetSortRootNodes(false);7 T: C3 o- x3 k1 c. \5 z
- modelhistoryNode->Expand(Node::ExpandOptionExpand);4 X: `: p$ j6 [1 [8 f8 W& `) N5 [
- // get all the features with values D5 ?9 m3 z# a
/ w' I% v$ n" }8 L/ k4 W5 L& K0 ^" M- std::vector <Features::Feature *> nodeFeatures = getfeatures();
) Z7 o1 A. [; ^) H. |6 y, L' A+ f - // insert the features: n9 f- F6 y) U3 P3 a
- for(int i = 0 ; i < nodeFeatures.size();++i)
! H& A% w; L6 h X% s5 s - {6 S* T& q/ B( P, |' h
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());, {( O: K: c% _
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);5 y5 S% @3 t( G% W
- . [$ H, S p; j c/ x- R
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());4 ^0 `" b- x) C
- featureNode->SetColumnDisplayText(2,"check");
! p! i/ c! B- \( g' f) k - 8 Z) f" J3 x8 P+ I/ v& z" c
- }
( i2 y J+ d4 p5 k0 Z6 d -
/ h, \; y, U5 q2 u/ c+ R - 4 `$ Z0 B! G7 U8 z- z5 j, ^6 p
- }. l! [) u% A( G
- catch(exception& ex)
- v) ]' f. ]# l - {: y( y6 K! F5 B, k" g( K
- //---- Enter your exception handling code here -----
# [5 s3 s9 c: Z2 q9 R7 Y. n - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());2 s( P& d8 ^ Z3 ]3 G
- }, u9 G' ]% d" g) @5 C% z
- } d2 c; I: c2 M
复制代码
9 g4 ~2 D, a- k/ [
5 k. ?$ g1 t% ]* E' o, Qtreelist的创建,需要在dialogShown_cb()里面定义treelist的内容4 ^+ C8 E0 d, o, G6 k0 J
+ @/ `$ e6 Z1 p3 g
首先通过InsertColumn 定义列,有了列才能创建节点Node8 j( Z9 h3 p, B0 z
/ i# w7 k4 |0 O! d
这个顺序非常重要!+ p6 [% c/ k! S3 J. ` O
V4 ?" z" f5 \% C
treelist 树控件创建
9 B* s6 h% Z f9 J1 v3 d0 G6 U1 q! ?6 u
|
|