|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- void tree::dialogShown_cb()
' g- q! _! g8 Z; z( h, e- g - {
1 F/ p/ f& r+ f0 m/ G4 j- E6 B% h: O - try; p' U2 H) @+ | @& a
- {# O& J/ m; l% K" b
- //---- Enter your callback code here -----% ~+ } A! q# X1 \
- / v% w* ~- ~& j% L9 T; j" ?
- " o; c/ c. W0 F4 d
- tree_control0->InserTColumn(0,"Name",140);5 y$ o4 u% d, e8 \. n
- tree_control0->InsertColumn(1,"Feature Type",90);7 N- N/ Q4 m! c& b% q. @
- tree_control0->InsertColumn(2," Up to Date",70);
- j0 u; ]8 n$ x1 E/ N; g$ L) S6 ~% x: L - " h4 I3 z( e% q2 O, d2 S: @
- tree_control0->SetColumnResizePolicy(0,Tree::ColumnResizePolicyConstantWidth);% u8 r, `' Y7 s( a! V
- tree_control0->SetColumnResizePolicy(1,Tree::ColumnResizePolicyConstantWidth);
% e' B; @+ z$ v ]: g - tree_control0->SetColumnResizePolicy(2,Tree::ColumnResizePolicyConstantWidth);
6 B0 [. m; ?6 C2 ?6 ~8 E& |% E - 0 V6 L7 Y. C. J o8 n
- tree_control0->SetColumnDisplayType(2,Tree::ColumnDisplayIcon);) R' v& A( y% R. C7 B7 V, B- O: {
- 2 W! e- g9 N' N/ X7 f4 N
- // create historymode7 ~+ U( g$ _( i' m7 L
- historyModeNode = createInsertParentNode(this->tree_control0,"History Mode" ,NULL,nodeIcons[0],nodeIcons[0],Tree::NodeInsertOptionAlwaysFirst);
7 M% u7 a6 D8 `# z, n - viewNode = createInsertParentNode(this->tree_control0,"Model Views" ,historyModeNode,nodeIcons[1],nodeIcons[1],Tree::NodeInsertOptionLast);
& I% N" a% ?/ S# | - camerasNode = createInsertParentNode(this->tree_control0,"Cameras" ,viewNode,nodeIcons[2],nodeIcons[2],Tree::NodeInsertOptionLast);) Q' o) |( N4 M6 ^8 }9 ~& W9 h, ^
- modelhistoryNode = createInsertParentNode(this->tree_control0,"Model History" ,camerasNode,nodeIcons[3],nodeIcons[3],Tree::NodeInsertOptionAlwaysLast);3 U8 N2 r& B; i8 B" c" ~/ s' C
- tree_control0->SetSortRootNodes(false);( {- k) r0 Y# q4 |
- modelhistoryNode->Expand(Node::ExpandOptionExpand);
: w" z. u% W( u5 [% o* ^( G. m - // get all the features with values
3 a; h" U L- B3 Z0 |- q4 V) {6 [/ _ - - z, [: v* _+ V5 |% j
- std::vector <Features::Feature *> nodeFeatures = getfeatures();5 ^& ~3 V8 Y' s0 Z( h- S8 m
- // insert the features
% [+ y' V. x$ i - for(int i = 0 ; i < nodeFeatures.size();++i)+ w* E0 J# w- N, ]
- {9 [4 }: F- ]5 P/ ~% K& c$ \' a! i7 q& Q
- Node *featureNode = tree_control0->CreateNode(nodeFeatures[i]->GetFeatureName());
( Z1 f' T) e) {: Z8 d - tree_control0->InsertNode(featureNode,modelhistoryNode,NULL,Tree::NodeInsertOptionLast);" z( g' K* a, U+ N1 N
-
# A. x! s# }: d% s& v - featureNode->SetColumnDisplayText(1, nodeFeatures[i]->FeatureType());
( D! K. I5 |5 N" s4 c$ }: I - featureNode->SetColumnDisplayText(2,"check");
f" f3 |, r! C$ D9 m$ w& g - . }: l# r# }, T- r1 O% U( h: z
- }
! K: E6 [, I e* u" r -
& Z5 x3 ]/ l2 h
$ l$ a3 { b9 ~% O" U$ [# y0 D, x( [* O- }8 W. r/ M3 F/ o1 d3 \3 a8 F, N( K) e
- catch(exception& ex)) S+ U8 c9 M7 z1 Z6 C( a) D5 W# d# C
- {" h2 f3 n0 u4 R. C
- //---- Enter your exception handling code here -----
) ~. b C/ F- C; Z' I0 p& L$ ^5 z$ ] - tree::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());$ r9 w2 G, A; _# q+ n( C2 Z
- } h- X h. N% F N( I4 e
- }' J7 q. O2 S5 X4 j
复制代码 3 ?. C+ F9 X2 Z" W7 N) b
# J2 e3 e; @, v1 g3 D
treelist的创建,需要在dialogShown_cb()里面定义treelist的内容
2 Q2 p1 u) f# z' q. F$ D' ^- m3 Y6 v7 f
首先通过InsertColumn 定义列,有了列才能创建节点Node
9 s0 z! v% b4 x5 p7 \( |
$ H: N6 Z) X$ f, R这个顺序非常重要!
+ |, ^6 M7 G3 Y: F3 S9 y0 U4 H4 h2 ]/ V/ k6 N3 x
treelist 树控件创建
0 h" T4 r* B9 s- }; }) i4 `: e3 M I6 U" c6 `
|
|