|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
7 _" n+ y9 A8 |7 P
经典界面到RIbbon界面转换
+ G+ T( O1 B! Z: Y8 V
在经典界面下,需要的文件. T& D( K% k1 u4 |% h
- customer_men.men
- customer_toolbar.tbr/ F, k8 h. ?/ c
在ribbon界面下你可能需要的文件
# ?; l9 [3 f- `% o$ i: A
" ?7 l( a7 J* A# q6 h) f1 a' |) m) K2 w9 c' a5 S3 \
举例如下:/ F. B/ F# K8 y
' p2 I. @6 N& y! Q6 Q, K
: K s( p% y* O$ J; m/ q
customer_men.men
, \2 _0 G, ^$ m. U!
2 A5 @: e" B- D2 C! Customer menu file
: b' M, A( R2 U- Y" A. k!
) J; o4 y- {/ \ k* N! Contains button definitions to be used in + l& f9 A5 ^$ p( O
! toolbars and Ribbon files
/ ?- s I' @4 X$ Z0 Z( t, @- N!
3 [; ~* B3 ?0 K& t" F' A
4 }5 p. s; y$ J- EVERSION 1200 R) R. [; |/ ^" N3 c+ y
# s: F, {/ F% l; ~. n6 t
EDIT UG_GATEWAY_MAIN_MENUBAR
. t* z. v' Y- r6 ] h- {$ h c. L2 I8 V6 t- Q
TOP_MENU# D" d: C. F; S5 @
CASCADE_BUTTON CUSTOMER_MENU
: L8 }- {4 d) w& `& U LABEL Customer Menu* J/ j4 G# m) ], y/ o
; m+ D! F! w. }& W* [1 v& _" q. g, @) g7 [END_OF_TOP_MENU
/ z( k2 Q8 f( B5 Y1 j/ \! h) w) E. F
* Y5 y7 t# U$ f! u1 v8 ]MENU CUSTOMER_MENU6 N, R6 f' g' D" t5 W( Z" A- K2 a* I
: X, g3 }+ F$ N BUTTON CUSTOMER_BUTTON_1
* \5 [5 f; j1 R' x* W# Y9 W LABEL Menu Button1" {2 b( D8 s+ Z4 ~
RIBBON_LABEL Ribbon Button1. ?9 H: \& ]# l, p
TOOLBAR_LABEL Toolbar Button1 b) b& D3 S; h5 T) p1 s8 H' M3 H% [
BITMAP fileopen" F) p7 r% u$ x* [' M
# m2 {* c( Y/ t' L7 R" ] BUTTON CUSTOMER_BUTTON_2
- o9 Y3 N( I9 B. {: l5 l LABEL Menu Button2
+ ?% s- t8 b& J% s( r4 g RIBBON_LABEL Ribbon Button2
$ Z$ A7 ^; h. m# b7 X# | TOOLBAR_LABEL Toolbar Button22 Q; S0 T7 m. I8 H$ z5 ^+ O- D3 o
BITMAP filesave
- p* r8 G3 r* S4 k4 L# S; w
7 U+ L; J4 m* P: k$ n BUTTON CUSTOMER_BUTTON_3
' _* r7 c5 P- P+ | LABEL Menu Button3
4 F) `) t2 L% t' N: l+ }2 \ RIBBON_LABEL Ribbon Button3! i7 J# v/ B/ n& ]
TOOLBAR_LABEL Toolbar Button3
$ N9 [, W3 y5 d. a% }' m- m BITMAP current_feature
! r/ r" ?" o; k* S0 { F$ V8 m$ R7 b. i9 \3 \0 D$ y' T6 ^" @
BUTTON CUSTOMER_BUTTON_4
' z3 ]+ v1 D$ _. ? LABEL Menu Button4; c( F* A p, K2 u& S
RIBBON_LABEL Ribbon Button4
& J; h- c$ y- Z( ~" U! ]8 t" | TOOLBAR_LABEL Toolbar Button4
4 o! D8 j7 A2 ?1 z3 m) N BITMAP block# C9 u. D: O9 I+ Y( ?
4 m+ h6 V; W3 v: {& \+ o, Q
BUTTON CUSTOMER_BUTTON_55 f' u% q7 C0 E; X. A
LABEL Menu Button5$ G3 @, h7 `% [* B3 l! f% D- h1 [
RIBBON_LABEL Ribbon Button5
- Q8 }# X' C) X: I TOOLBAR_LABEL Toolbar Button5! o$ Q- m a% B- W) [5 {
BITMAP checkgreen. r. |) @; v* w. Z7 u0 L
" Q( M5 t, Z% c* H% b% D
END_OF_MENU! w( p3 @$ Q& `/ c
( x) P0 f0 A/ c8 _' {, A' ^0 m/ k8 O1 M
. ]7 S3 Q) J) {# Dcustomer_ribbon_tab.rtb
3 w( N6 v1 P$ Y! P7 F!
( v3 o5 w) X# `: m. h! Customer Ribbon Tab
# G- ~5 b# W8 V1 i' @- |! 3 k& {# ?7 f- f1 P' M& p+ ?: ?
! This file will create a new customer tab containing three groups and5 j' t7 T* ?7 k5 A4 z
! one top level button.
$ \! X0 Q ] B: g8 s!1 r: m& G9 P2 ]" q9 K% @ e
' T) k! j* A6 ?8 n0 U4 A0 }* RTITLE Customer Tab% q# g' M' ?/ _ k P" i1 W
VERSION 170
F7 k# t# s$ ^' J$ c) ]1 J/ \9 k
! The first group represents a Ribbon group that references an existing
4 A3 C3 _# m" b0 N+ h! toolbar with no Ribbon style changes. ! _4 x7 {4 ^& x. c7 I$ `. e ^
!
& _$ w. W! F" S/ f, m1 E! This is the quickest way to add existing toolbar content into Ribbon mode.
0 B3 O6 U5 i$ y! h!
9 i! Q7 c6 l0 h; FGROUP customer_toolbar.tbr: f, g# S2 K: i' U C
3 Q& u8 j$ [! N) ?* Y, |. E5 r
! The second group represents a Ribbon group that references an existing
6 z% w2 ~& x" \) u6 |* e! toolbar with Ribbon specific style changes added to it. There is no difference, x9 I8 r, z! ^: y+ ^) S$ h
! in how this toolbar is referenced in the .rtb file compared to the first
% t& J6 _9 S; @0 Y+ t* ] \7 Y r- g! toolbar as a group. The only differences from the first group exist within 5 \% I h, G5 Y- c4 _; _
! the .tbr file itself.
3 c, U% c' E! l$ e!
. ^0 N" H2 n( {- a/ D! This approach has advantages for customers that will deploy both Ribbon and
9 Y" p' `# r' J$ b0 a8 m" D! Classic Mode customizations since all the content is defined in the .tbr
: l2 A: I7 U/ W+ }% F( A$ }1 }% h! file and it will stay synchronized in both modes. Only one set of customizations
; f1 D& N4 F' s! will need to be maintained while still making use of RIBBON_STYLE to 7 B6 |3 c$ }6 Y1 V& y/ j- `& ]
! control the presentation of the buttons on the Ribbon.
, `6 r x q) K4 y$ w- ^4 B!
! e- Z+ ]0 L% _6 |: lGROUP customer_toolbar_alternate.tbr) x8 G( s0 \8 {, j+ I, B' d7 |
% S# C; ~% U7 q! The third group represents a Ribbon group that has been created explicitly% ]5 Q* U, d- u# ?% v8 h) c/ k" Z, f
! as a Ribbon group and will not exist in Classic Toolbar mode. This is the
- y7 b( p* T* C/ B' m7 k' R! preferred option since the user will be able to take advantage of all the v/ D0 N) c9 J& j
! layout styles and containers offered by the Ribbon.
" k. r0 z, K; m: E!
, W- r. I* E# c4 \: _: p! P% r! For customers that will deploy both Ribbon and Classic Mode customizations,
4 ]! q: \! z& Y" y! this approach will result in no synchronization and two sets of customizations
& j' {/ r% v) R. L4 u; D+ Z! will need to be maintained.
( M1 D/ q) ^8 F$ G- _4 N3 |: g% ~!
# J3 d% a4 k2 E: L! A group can alternatively be defined directly inside the .rtb file by using the- X6 E( D* N2 |, [! `
! keywords BEGIN_GROUP and END_GROUP.
2 }8 l- ]2 H! d' _8 }4 M: C!+ _+ i& o. d( s" t8 w
GROUP customer_group.grb
8 X1 b1 \4 p4 N( |( e) p( a
- J( o$ E* I [3 e4 g5 C! Example of a button that is placed directly on the Ribbon without being
. q$ V7 Z3 v1 L$ m ~: W' z! contained in a group. This is a simple way to add a button to a tab
1 g4 ]4 n2 l# a$ {4 C: }! but is not recommended for many buttons since groups have advantages.
- c* p; L: e/ S& D9 b! ! _% h2 j6 Y% i: m% G
! A few advantages of groups: q5 M$ t3 P2 q: g0 U
! 1. Easier to move many buttons around together in quick customization.
9 K, @: J3 n! \; R. G! For example, MB3 on a group and choose "Add to Left Border Bar".
! v' \/ a7 K7 _1 n$ u% v! This will move the whole group to a new location. If buttons are
4 c4 y+ x0 y6 T( m! g! not in a group, they need to be moved one at a time." y% D# ?) K# x
!, F' f/ T; k# K% D$ M
! 2. Provide a label to describe its contents.
) z Q: J3 `6 f!
0 S- p5 Q: A; ^. Q4 ^BUTTON CUSTOMER_BUTTON_1) E- Z' {$ X4 H. h' b
LABEL Button1 Directly on Tab
4 O" N1 a$ f+ h! V7 @/ h
( n! f/ ^) H9 \) i; Z' {# M
+ T" `% v. ~1 \9 o2 _
& n: J4 ]0 r( b% P" Lcustomer_toolbar.tbr9 w- ?2 i0 O- A) |$ ?0 x% {2 Z
!
y5 L1 u% z' E7 ]$ N) l, s" a2 H! Customer Toolbar File+ r# V( I! q; x, K' O& Y
!
, I, _5 ] ~+ \! This is similar to an existing toolbar file containing
& l" E. l5 u; E; W% m! no Ribbon changes.
( \0 ^! U% b! ~!
2 B0 ^" D* L7 C2 o* E! In Classic Toolbars mode - This toolbar will still show up in the & s! {) y8 ^! |, @/ C4 m
! toolbars list.
! r# M8 q+ H2 ~; A d!, V% h* B7 B/ F5 x
! In Ribbon mode - This toolbar will be automatically converted to a , I; s- h" [6 Q/ R5 |1 `0 D
! Ribbon group and will appear in the "Classic Toolbars as Groups"
8 n. Z( p0 v+ V5 j. A- _9 y! section in the Customize dialog.
6 f0 M; s5 t& q4 R!
7 v; t2 P% }8 `+ J5 ^
5 j& t6 Z+ W9 r: W" mTITLE Toolbar" i. [ |! g9 T! N% N0 G! J$ J0 @
VERSION 170
5 f9 p! _2 ]4 O! l
7 Y: Q6 [& i# r1 LBUTTON CUSTOMER_BUTTON_1
/ T% k# T7 J5 K; Y2 y. J' a* _7 @6 z4 U) k) m* {
BUTTON CUSTOMER_BUTTON_2/ o9 _( \# r. F! x8 z! t
) t( }3 ]' U4 O b% aBUTTON CUSTOMER_BUTTON_3
- ~* S0 | z p. | p2 B C% n& R% A! f1 O
BUTTON CUSTOMER_BUTTON_42 S; R( ` T1 |( Z
7 @7 Y. Q6 k0 W$ }
BUTTON CUSTOMER_BUTTON_5
, Y& W2 D5 q3 ~) {1 }, s/ D7 v0 d7 @
; j" V, l7 N0 H4 i, n
S7 l& R& e! U# [& P
customer_toolbar_alternate.tbr
, w9 l# V R1 |! A% J7 P!
, {: l! ^) p0 F8 \' `2 }1 E/ A4 w6 l! Customer Toolbar File (Alternate)6 T6 h. {4 k, t# w' k
!3 m; f1 C. z. _
! This is similar to an existing toolbar file with new
/ t) Q* V: G+ g2 u; c! Ribbon styles added.
% v* q- D3 `: _1 S1 N! 3 r8 _9 ]; B- |3 Q
! The RIBBON_STYLE will be honored when the toolbar is loaded 2 N% T: l; c5 n
! in Ribbon mode as a group but will be ignored when the toolbar 0 I S6 |- k# a- [! i O
! is displayed in Classic Toolbars mode.
6 H4 z X% y3 g5 D4 j) q" N!
* w3 T9 s# r6 }8 B M0 g! In Classic Toolbars mode - This toolbar will still show up in the # j2 Y" L8 U3 N* O
! toolbars list.
& c. r) `0 W; m6 m!
$ X- G4 k* r) [/ v" X1 Y7 v! In Ribbon mode - This toolbar will be automatically converted to a
- [+ s4 Q/ X8 b! Ribbon group and will appear in the "Classic Toolbars as Groups"
( O* o3 ^2 }/ U6 o2 ?! section in the Customize dialog.
$ P* S+ c6 h. f& B1 i# @, G!
, ~( w) z, {/ S7 r
, R7 j% Z& {- |* ?# r& HTITLE Toolbar (Alternate)
% L/ i- V2 { o7 a7 K; mVERSION 170
# f( d9 e+ ~- i) f0 S0 F
( L# K' b% N5 L8 Z2 o& ]" \/ J4 ABUTTON CUSTOMER_BUTTON_1
* @/ c; ?+ V6 jLABEL Toolbar(Alt) Button1
3 f- v1 P: d0 [RIBBON_STYLE LARGE_IMAGE
: R( r" F( ]% ?. E5 \9 S: K9 Y1 ?7 R; ^4 f
BUTTON CUSTOMER_BUTTON_2
; v& J' S* h+ ?9 ALABEL Toolbar(Alt) Button2+ g" n" a8 q# E$ ~. {( `& a+ e
RIBBON_STYLE LARGE_IMAGE; Z1 ~) w B! v* {* E$ V9 l
" V* @7 z5 q% {/ c( f/ I
BUTTON CUSTOMER_BUTTON_3: P9 g* W' c' L4 v) t- Q1 {
LABEL Toolbar(Alt) Button3
9 K# Z9 B: r$ C+ y, u9 @3 C3 URIBBON_STYLE SMALL_IMAGE_AND_TEXT
: z0 ^0 M8 V6 {% u% ^( c) x( ?
3 \5 G, |4 P) b) ^BUTTON CUSTOMER_BUTTON_4
. M; a" W1 X$ ]# X' S& S- D& P$ OLABEL Toolbar(Alt) Button41 D* r7 Y5 c- ^ \" K- c
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
s4 d: W m4 f X/ y/ n* l$ Z
BUTTON CUSTOMER_BUTTON_5/ Z) A5 s' c5 k) q/ ~
LABEL Toolbar(Alt) Button5
; R2 E' D2 J3 A" v, IRIBBON_STYLE SMALL_IMAGE_AND_TEXT. c5 a, I6 M$ Z+ B: P$ B, g
* g+ p2 r H2 m1 }2 T' u
/ o8 K$ S" Z3 b0 ~* m; A) l& `+ w+ V, q& p4 \
customer_group.grb9 H0 d2 q. H# ~: {9 {+ Q
!8 x9 j* @% z/ p3 `8 @( E1 L. X
! Customer Ribbon Group File3 I; x- [6 n& x: {. _- Q& V
!
; `( j- u5 b0 Y! In Classic Toolbars mode - This group will be unavailable+ u: Z% Q" q" Z
!
0 C. h1 H( J" @* K: k; X! In Ribbon mode - This group will show up in the "All Groups" list
( h6 T. ^) b5 d0 R9 l4 E! in the Customize dialog.
! f# Y, W9 N5 L!
4 T' D1 f [% u7 ~ S9 R! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files% @3 ^3 v+ I! G0 R% u" B z
!2 d V! @2 G8 a
, P( V( w. N7 x. F( FTITLE Group
1 O- K. M& B9 R. IVERSION 1709 `9 y2 r0 S. r' v6 I% N
, s1 V4 o: B+ |1 w
! No LABEL defined, using RIBBON_LABEL defined in customer_men.men
_, a3 H% d6 z3 a* }+ vBUTTON CUSTOMER_BUTTON_14 |2 x7 W5 T9 h6 N& \: k8 ?
RIBBON_STYLE LARGE_IMAGE8 R+ V% f; W+ t& |/ s& e
7 T, ?; w* s3 l
! Example of a gallery defined in a GRB file.0 T) T. J* h% S R$ h* H) x
! $ j' k( u, D" O+ q1 b2 T
! If this gallery is to be used in other places, then it could be % @5 s t c: D7 M. \
! defined in its own gallery (GLY) file and referenced here
: V' Z4 s" C& H! Example:' z6 z; F# o% }% _
! GALLERY customer_gallery.gly
9 X* f* m; i; A5 o/ }. Q+ j' H d!
. C' z) n4 p9 X* c2 yBEGIN_GALLERY CUSTOMER_GALLERY
! W! i1 z% l: a% {7 iCOLUMN_IN_RIBBON 2( B4 G8 d4 D% e
COLUMN_IN_POPUP 26 [1 W9 O5 L- j+ z z, `) Q
LABEL Gallery4 O4 A* y. n6 c
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT0 w, A4 D( j6 |: r$ r
$ e; G4 M# i; F5 z; ~+ S6 f BUTTON CUSTOMER_BUTTON_2
# |& D1 f) y! r: t& ~1 p" O q2 u- v- z
BUTTON CUSTOMER_BUTTON_3
0 @8 j1 Y/ j y- K' A1 R
c0 K" A1 p" U4 b6 ]% m% O BUTTON CUSTOMER_BUTTON_4
k' M3 `- z m T9 M9 c4 y
& v3 V- q7 n _: m: G BUTTON CUSTOMER_BUTTON_5* C$ `) d; c2 n* @2 E q
# S. e5 N# E9 ]- R" l' z
END_GALLERY
9 e$ }+ \4 |1 P4 c
+ e6 s3 V7 E9 ~6 o! _# H5 c s) C5 f( K4 r0 E3 h2 P3 K& v% g+ @
|
|