|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()& f3 ]- h) h, Y
- {8 d& j/ E) Y. X0 `. s4 Q( d
- try, F" E( c; x. T# U" Y, E7 x
- {
3 u( e; e$ Y, [& Z - //---- Enter your callback code here -----
; N) c. J8 m1 ^. W' T& l1 F! }
" }, L3 C% [; b. ?! |- ) d% h" `! I- E0 ~4 l. `
- tree_control0->InserTColumn(0,"Name",140);
8 \% b5 |; Y f `9 P" K# S. d - tree_control0->InsertColumn(1,"Feature Type",90);
9 r$ D+ e$ J ?/ Y# H/ Z - tree_control0->InsertColumn(2," Up to Date",70);
9 D6 B+ `; T) [# }
$ R# c; p- g" o- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);6 D x3 A: y2 w* J K6 k% h" m
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);( B( O3 s; `7 `1 U9 `# |) K# d
- tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);8 V( s! t8 N+ h* [2 m l
+ a; n: |& Q5 d5 L" S$ C- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);
) I1 h+ \; ]' e& c: S8 o' Y8 L
7 G* l# }3 H4 ^: [7 `' K7 w' ?- // create historymode
( e' q" Y/ G" \ R1 V: a - historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
3 S7 F4 p( G6 K - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
) S* q- Z% }" w2 y - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);$ x- |; D2 {- q- O/ ~% I% S8 k- A/ i
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);! `9 U" S7 ~2 G! z5 T
- tree_control0->SetSortRootNodes(false);
- h8 R% P( d5 W8 r- e9 u - modelhistoryNode->Expand(Node::ExpandOptionExpand);
3 M: t2 L; C4 q& u9 F# r - // get all the features with values 8 d& Y6 I, i3 b; l
9 I( X/ X9 ?8 A5 Q- std::vector <Features::Feature *> nodeFeatures = getfeatures();$ U! G/ k3 V0 Y7 s8 I! [1 g# g
- // insert the features# f6 ~0 j v8 E% X
- for(int i = 0 ; i < nodeFeatures.size();++i)& S5 H% o! `4 j+ a4 T) S0 `; Q
- {8 E+ p! d* q& J; B0 i: N/ T5 I
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
; ?! \9 [2 d4 w+ l - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);
8 n3 F6 p0 \! W4 H$ x - ; q; Y: b9 U# p; w6 f
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
* U4 g, D h9 m3 e* _ - featureNode->SetColumnDisplayText(2,"check");+ R; G( w0 H4 r6 e
( {: i9 W* R' g" w, L' @( D- }+ R& D* H; ]0 R& s" N( C
- + \3 ?$ @1 W/ s+ E% Z# I/ G( x
" l: r }& x! s, ]7 [- }
9 j a3 M$ _/ n- u( M - catch(exception& ex)& W8 g9 h5 m* Y
- {
/ q: R1 N+ j$ V; o, B8 N" ]( B - //---- Enter your exception handling code here ------ Z& }. u5 |* t) `( H
- tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
4 w9 n: O. A. f* R& V - }. N0 R! b- c8 G. }0 x
- }
" C) }1 L5 t- j2 v2 S( H
复制代码 ; P2 _% ^) z+ h0 b
. s5 G" s' ]1 z- @# k+ S" A, o
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
' [& Q4 ]' T/ u7 ?: e. i$ b+ o' x7 W. D5 a6 M. B+ Y
首先通过InsertColumn 定义列,有了列才能创建节点Node G& l" T/ g M8 ? o! a: T( H
) J6 X1 o# r! U3 C) d
这个顺序非常重要!( d. w( l( @% P" A
: K6 {. y- s7 q4 p) {9 R
treelist 树控件创建
R! R8 W; ?+ d8 O4 @) }
/ z3 V( w: v" L- O
|
|