|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
) G' x6 l3 X% g - {
# m% h) o- ^4 `" |9 D; p - try' `, Q0 e' u$ G3 k
- { x6 l- {5 p. y' t
- //---- Enter your callback code here -----; O6 G! \+ H c
- * @/ u$ V, O! e
-
7 c1 E ` r8 z9 n* C& ?% H% S( D* b - tree_control0->InserTColumn(0,"Name",140);
% e, P! |0 R, R0 v8 c' h - tree_control0->InsertColumn(1,"Feature Type",90);
! Z) F0 E. `) D1 ~7 S T - tree_control0->InsertColumn(2," Up to Date",70);: u6 |8 d5 l& V4 ?
6 l% u$ g9 O- p0 O7 o$ i7 `- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);: t" n v9 s, @; c$ Z; @+ q2 P" k
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);7 F6 o' E/ |; R3 T, w8 Z1 a
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);/ D2 d# B; O9 T9 z# n
* a: x8 f) E& [1 M" r- i- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
( Q! S/ q& p2 c! L$ k$ d" J
1 R# r8 B# F; N! |6 x- // create historymode
2 x, p9 n( h6 E- } - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);4 T% v1 w. b& ^6 i
- viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
- E- Q0 M0 J+ t" N3 I' S - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);, G. t. C# l+ X6 {2 k) ~2 V
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);5 t. E" Z' T' Z9 b& H
- tree_control0->SetSortRootNodes(false);* d6 D P9 L& _! L
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
+ O* |( k; s- e; ^: H9 C - // get all the features with values , Z3 E( z8 f G3 ^
- ( }" p; I5 r6 w# l' l
- std::vector <Features::Feature *> nodeFeatures = getfeatures();" s A, `& A; N7 g8 r/ r9 x% p6 Q
- // insert the features S/ R- i2 X! v3 V3 l7 a; J
- for(int i = 0 ; i < nodeFeatures.size();++i)9 d/ ^ o- D2 F3 i g9 H
- {/ i& A( ]5 J% t& B, a3 A
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
~; R) @' @ ]7 [* e: J. g - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);9 g% ^. v& c4 d2 A* c. L) ?
- 7 f% p6 o) m! n
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
7 B& ~0 [$ f8 p7 R* p* g! v - featureNode->SetColumnDisplayText(2,"check");8 d* h# U# v! ]2 r, ?9 q
( a+ F }% k0 U K! r# \+ q0 Y" I1 {" h- }6 t6 }+ y5 n$ S& {3 a, n
- ( P8 D1 I) q9 f+ N( z
- 9 r( M0 }2 p3 w# y8 v) ?/ D M- {
- }0 L1 ~5 n: ~! K6 B* C
- catch(exception& ex)* W* H1 p; f* J4 Z1 Q
- {
3 y Q# b; L* p/ j8 ]' Q' H - //---- Enter your exception handling code here -----+ _. Y; H5 G$ ~
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());! [1 L4 U+ H+ _9 E" f
- }
9 U% u' h$ `" e# W' k h/ R) t - }
; W* R9 _& K9 K7 y% ?
复制代码 6 \) ?" H2 w1 M
& W* B" {; v/ ?2 z! i' x( R
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
4 T/ G$ L% d8 h N, J8 v: j
$ A2 ^+ g( h4 F首先通过InsertColumn 定义列,有了列才能创建节点Node
' v, z0 G9 X! B1 }/ B8 i2 u/ Y; E( ]
A: n* V% b- v9 z- B9 |" D0 I这个顺序非常重要!6 T4 Z9 h4 L/ Q0 p+ k- u' L0 V
% M) ?8 E; k( V3 I5 D+ L8 g+ v5 e
treelist 树控件创建
7 Q0 L. ^$ o& A, q5 g6 b! e/ v
9 r. m+ z! Y, F& L
|
|