|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
8 R$ @# U4 t) \! G: F - {/ g' m! }+ @7 G
- try7 d* Q! d+ I2 x' k7 I" S* C1 ^
- {4 c% D% {. \" a1 H7 b7 y* Q
- //---- Enter your callback code here -----; ~, j m& {8 h9 ]) A
' z: N; {( U Q-
0 D5 d4 T& ~3 @. p3 o+ K" a4 E - tree_control0->InserTColumn(0,"Name",140);1 h0 k+ @, q" m4 t
- tree_control0->InsertColumn(1,"Feature Type",90);
" O$ M m9 i- y) k+ `% L }$ ~ - tree_control0->InsertColumn(2," Up to Date",70);
' f7 X" r6 X. d3 X) |) ^- F
" b8 }7 m6 ] e7 `: f" Q- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);: J5 }/ W) ]1 e% w5 t! N9 M
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
1 m" U5 e e! E- L& H - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);, t9 k4 G8 I4 z% I9 S% U/ i
- 0 p4 t4 y- y3 L0 {8 _
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);, w& y% f6 s8 p' t/ z4 X
- 4 R* e) Y# J4 f) L2 c# w# K6 Y
- // create historymode( p. s9 Q' {% ?5 {7 L* y7 u, Y
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
/ ^, f2 v* B& n8 u, v) q - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);0 s% ]) ^) ^2 ] M* s0 k: q; a
- camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);5 v! Y. x. p% F
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);; t. s0 N/ V2 q) s" ]
- tree_control0->SetSortRootNodes(false);3 X/ N5 [. m0 t+ B" ~ ^0 T
- modelhistoryNode->Expand(Node::ExpandOptionExpand);0 v, |; k1 k) N$ w7 @
- // get all the features with values / @6 Z( e. {0 G. b2 g7 Z
- 5 h. g0 j" A# Y2 Y2 {
- std::vector <Features::Feature *> nodeFeatures = getfeatures();8 i5 i, l. r. V5 b, t3 |
- // insert the features9 [9 o! v, d: w; V) u4 ], l
- for(int i = 0 ; i < nodeFeatures.size();++i)$ K h1 u! P+ m) x; G
- {
5 Z0 Z7 `) |( d! K& [3 F8 {; n - Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());1 v7 L9 s# D4 W! g
- tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);; w1 e0 R2 Z! x1 M1 t2 X
- + |- y' D/ X! Y0 @( j
- featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
3 R3 `. G& [5 z8 ?2 w% E - featureNode->SetColumnDisplayText(2,"check");
4 b! `, v; d, m0 O+ z9 W0 c/ M - ( v9 \8 S9 m: P* @: M
- }
E" }' S7 }3 T, R - - X8 Y7 p' [* n3 u( S
- 9 t3 p$ ]% u3 i! X. B4 r
- }
2 K0 J4 b/ N7 f3 g/ _6 u1 Q - catch(exception& ex)" t$ V: \( }+ g/ \$ D
- {/ E, t# d! m& b; G2 C% `
- //---- Enter your exception handling code here -----
2 g! ?2 C2 F* B* h+ d; O$ n3 u - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());! f6 b& |' `* h1 M. b
- }0 ^ Q* k1 Z' x( ]2 g: t+ f1 `
- }! e8 ]1 {! P# f0 s: M/ V
复制代码 # {4 V! L* ]' e! E
, x! B8 t/ M& S# o2 i
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
l8 E+ N) Y3 d5 V/ _0 _" M, v/ e9 X; U% S& Y" A w7 X
首先通过InsertColumn 定义列,有了列才能创建节点Node- F- |' Y* A, \1 F
2 C; [2 V# o- S& i6 Y
这个顺序非常重要!
* k! u8 U4 |; P3 h1 O
8 R a$ }! F! Q5 ?: ?7 B
treelist 树控件创建
3 x. b: M1 o2 w, {0 i
. Y9 q4 a' G8 I! N |
|