|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()1 ` K: W N: c4 L
- {
* O$ M# c! a8 ~, P( K- b8 B1 g& @% I - try
3 v A& i$ R# Y# ?# D- j - {
( t1 X3 [9 U1 n5 Q( _% O, \1 S - //---- Enter your callback code here -----
0 s! @. g. a7 b* q Y4 Z
, d$ r, H1 I1 q- / W# t! {- E. `
- tree_control0->InserTColumn(0,"Name",140); f5 y2 a5 u$ B n4 p
- tree_control0->InsertColumn(1,"Feature Type",90);. I. R3 T, X5 j
- tree_control0->InsertColumn(2," Up to Date",70);% v# h! e* U2 t) x% E$ D
- ! U! L2 K' Q3 ^
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);. ^9 R, l$ s0 \4 P& S9 } W
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
+ U$ X5 V q/ ~$ S1 | - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);( M, v e' t7 _# Q/ {- U
- 5 R- I% i% d$ P8 G" {6 d j
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
2 f) t* f. v7 G8 Q4 x# z - ! J% I. M' A [; C6 _
- // create historymode: X0 Q& L! Z; U" \+ w4 C
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
0 I4 X4 A% U) ^1 W - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
2 T8 e. X z$ s) x Q - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);3 K+ J% ]5 [! M
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);
2 X( P4 O$ m4 `$ ^9 T( M - tree_control0->SetSortRootNodes(false);
F; C/ [& A5 t5 e9 e - modelhistoryNode->Expand(Node::ExpandOptionExpand);4 u& B. T5 e7 F# I) H( k
- // get all the features with values
/ V' b$ [9 ?& x% h2 M0 I. | - 7 ^( c: X, q! V: ?4 q5 K g% G/ m
- std::vector <Features::Feature *> nodeFeatures = getfeatures();
3 h* [8 S2 H, T2 F: B: M' G - // insert the features
/ T* a0 \* n5 G3 @ - for(int i = 0 ; i < nodeFeatures.size();++i)' ~+ C% C' ^. Z8 d0 h. h( `
- {
" I. [3 y3 s2 h - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
: j6 H. ]( k" n( S i - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
" |& ~, d1 l/ ?4 g1 m, X - 0 D$ w" ~7 _( ^) u
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
& M: `/ g% i' g2 z - featureNode->SetColumnDisplayText(2,"check");& m3 N# h+ ]6 F. N2 @" F
q1 S, K- M# e6 I- u- }5 i7 x! \. P* n% F% L; p
-
% C3 Z* S/ p M: m2 V K2 j9 i
6 q' W4 {4 t3 n8 q" N% h% [- }: k% y- H/ t s3 T
- catch(exception& ex)
/ B, _# N6 G9 O, i, _4 N - {7 a. P1 Q4 U* s A. X
- //---- Enter your exception handling code here -----8 c* s" E5 b! P% [, }
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());3 D- S5 ?- d- T1 X: U1 a4 v* @
- }
+ P, G& q j+ w, m5 B( s - }: `) k# D. e& ]. `
复制代码 1 A7 ?6 P. m/ f2 e4 E/ w! {3 \- F
2 [# c# ^4 Q2 H1 ~+ w# Y5 G1 X/ E/ Ltreelist的创建,需要在dialogShown_cb()里面定义treelist的内容% K; K' o6 c8 [
7 {% w* ?+ U9 N9 ~
首先通过InsertColumn 定义列,有了列才能创建节点Node: I- d7 n' ?, W! Y9 x, L7 M9 y" W
( W1 e) }2 ^2 M) X. X
这个顺序非常重要!
0 c) g$ J8 `* w8 m0 O/ h& W/ l5 i _+ s" B8 T1 t8 u
treelist 树控件创建
* ^9 [9 R7 F' L. k
t! ?( o1 J3 X# g l# x/ k
|
|