|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
1 B4 [! o9 e) }$ ~$ f
经典界面到RIbbon界面转换
I" v. ~. ~9 s5 O6 h) c/ }
在经典界面下,需要的文件
C, @: w, W! L4 p- customer_men.men
- customer_toolbar.tbr
" P1 k Q- v, q1 q4 I1 w" Q 在ribbon界面下你可能需要的文件 / t3 u! F1 r; s3 n W
+ {' z/ A7 V* }
, H4 [/ z$ H- S举例如下:8 e7 [; e/ E" K q9 i
3 S% z) M/ j7 h; w$ m1 p( T
6 Q+ _- R4 n' d* N# zcustomer_men.men
: a; W ^: Y! t% @. f$ \!' ~- |; I1 J# x9 w% x% e1 s
! Customer menu file
! {! z: y1 O0 h3 n; x!
8 ~- C0 o$ s+ u. x6 ^3 O& f! Contains button definitions to be used in
* E- U4 W* d1 _- \, b [! toolbars and Ribbon files& Q9 _; u+ E! _
!
, m v7 r8 {" [. n! @; x. G# k, X/ {$ ~& q, P! V" Y( o3 q+ ?
VERSION 120: O+ U; \- B( }7 M
# T& O; T q6 r* h, `+ W3 D* s
EDIT UG_GATEWAY_MAIN_MENUBAR7 t. c- ^* l; S1 p* }
; _! U8 }% P$ _8 s3 u+ }9 P& h/ J
TOP_MENU2 u, |% z4 @ _$ \' R
CASCADE_BUTTON CUSTOMER_MENU
. U% A( z9 ?3 t9 v' b; c LABEL Customer Menu
9 B* ^0 X" b( R7 R+ U
# j) Q4 ]9 w7 ]. a- oEND_OF_TOP_MENU; k; ]) p3 F5 H0 v4 F& A
. K; B' i+ y M* X$ N
MENU CUSTOMER_MENU7 v) ?$ A* V- o* f: g3 a
% ^9 L: d1 ^* g) x6 ]5 Q7 _! C BUTTON CUSTOMER_BUTTON_1
- v. m7 \6 m6 t$ N LABEL Menu Button1
4 O e/ @1 |0 Z+ k* @2 w RIBBON_LABEL Ribbon Button1% z* i6 s/ M4 W0 [% f6 v: i
TOOLBAR_LABEL Toolbar Button1
4 \4 m) m* X/ C1 m3 } BITMAP fileopen
4 M E0 ], q5 K: m f; a1 O+ A/ w; `
$ u" E; v ~2 f, C BUTTON CUSTOMER_BUTTON_2
# @1 C0 X: s7 i8 _5 a Q: J LABEL Menu Button2, d! ]; m0 s9 X, s+ \+ Z
RIBBON_LABEL Ribbon Button20 `: V% [( C, V" w2 t
TOOLBAR_LABEL Toolbar Button2, S! u: o4 t8 T( W+ B. M
BITMAP filesave
" ^5 G3 c9 j& B i# ~
9 L& S$ A& g$ Z/ r BUTTON CUSTOMER_BUTTON_3
6 k H, U! c$ k6 ^ LABEL Menu Button3
8 W. B- d- K5 S RIBBON_LABEL Ribbon Button3
9 e O! f8 @+ O! m' G1 c TOOLBAR_LABEL Toolbar Button3$ U+ e+ V( p. X8 V. x/ x. L4 }" \
BITMAP current_feature
! Q5 b) E# X- n, ^/ H+ e5 }+ w2 y1 [5 F7 a5 g) ^! V$ O; r8 G1 ^7 T9 u
BUTTON CUSTOMER_BUTTON_4
4 e' R& A/ G$ T: w. y: A6 E LABEL Menu Button4
]0 F# B, A. }# X RIBBON_LABEL Ribbon Button4, Y8 ]) O. h [, m5 m0 S4 f& o. P
TOOLBAR_LABEL Toolbar Button4/ H$ U& e7 }. T- }% X' r. ?. ]
BITMAP block$ Z. x% p# s6 R8 z1 a- S! M3 w$ H
2 G" M- T8 r, x/ ?) ~- l2 ^
BUTTON CUSTOMER_BUTTON_5- U# r, q) [. D' w. i; b# B( B
LABEL Menu Button5
$ Y, s. T; M/ t c, [" l RIBBON_LABEL Ribbon Button5% t8 H4 w* E: o, A, L
TOOLBAR_LABEL Toolbar Button56 C. M" p6 c* X) H0 s
BITMAP checkgreen- G+ u9 x* j% T9 W
& j7 S3 r! Y6 S) tEND_OF_MENU
) n/ ]4 I$ \& _( [/ e) Y$ |$ W) l' I2 {+ J* @: ]
( |/ e9 C9 D O
1 T) c' P; T+ I( z# e$ o/ y& _customer_ribbon_tab.rtb! ^* s& ^5 P+ X2 m$ |
!% _, E* t f* I9 W
! Customer Ribbon Tab) O( {6 N3 }9 T
!
# B. E( n/ e$ b) G! This file will create a new customer tab containing three groups and6 q# c% j) J) _) O3 P; `
! one top level button.
* d; T3 j* N/ Y+ n6 ^!1 o8 P% J/ D4 l) E2 c! [) L+ b$ d
) K" I, A6 V) `6 ]* I, h$ ^$ c DTITLE Customer Tab
1 B8 |' s- B; B( ?+ `/ I1 \. L! IVERSION 170
+ N* U, ?4 M; Y5 u$ v9 ?, X3 o, T4 t6 U( o3 |
! The first group represents a Ribbon group that references an existing 5 W# r5 O- J0 p8 J7 w+ e* q' w& {
! toolbar with no Ribbon style changes.
. S- v( o8 r+ ~0 y: ?7 J! * M$ G, Y" C2 R2 W
! This is the quickest way to add existing toolbar content into Ribbon mode.
2 Q/ b3 z, \& w4 N4 R/ `!
. @2 ^; \" o! q; v7 oGROUP customer_toolbar.tbr
$ A8 u/ |" `' ^# x
; e" g+ y' W" U* h- M/ z- h& a! The second group represents a Ribbon group that references an existing
" E: d- F F+ O0 G0 Y! toolbar with Ribbon specific style changes added to it. There is no difference5 {7 |1 ]2 k& N5 c" f
! in how this toolbar is referenced in the .rtb file compared to the first
4 n! T' S5 p& Q, K! toolbar as a group. The only differences from the first group exist within
$ Z, Z2 t" _$ b Y! c! the .tbr file itself.8 O J& X" C, A
!
" Z. P: D2 @- I2 P: T! This approach has advantages for customers that will deploy both Ribbon and0 }. [% p9 t( D; K# n8 T/ {
! Classic Mode customizations since all the content is defined in the .tbr
& q* U! L' z/ H) T' ~; t! file and it will stay synchronized in both modes. Only one set of customizations; p8 C( q. v7 Q# k- k/ r
! will need to be maintained while still making use of RIBBON_STYLE to
9 a D1 l( n) x3 L- F. z+ z! control the presentation of the buttons on the Ribbon.
& q! u- y/ x& }!- g. ^% X, {! q: u( `
GROUP customer_toolbar_alternate.tbr
& r( Z) a# g% Y, S5 X+ K! [1 W6 b; Z
! The third group represents a Ribbon group that has been created explicitly
. J4 B! u& c6 w/ L4 Z% {! as a Ribbon group and will not exist in Classic Toolbar mode. This is the
( ~- z$ ~! e0 T+ _7 N( s2 F! preferred option since the user will be able to take advantage of all the ' O7 L7 K, d) H, _
! layout styles and containers offered by the Ribbon. * p2 h. e" B4 \- L
!
9 t0 {% W- D, Q2 \) Q! For customers that will deploy both Ribbon and Classic Mode customizations, ( Z0 _; w2 h7 }) x3 |' H" j" m
! this approach will result in no synchronization and two sets of customizations % ]! z& W H- q- X* w7 w" Q" {6 W! f
! will need to be maintained.
# j6 q$ Q5 q& r" [!
! J5 n2 f" D$ i: C' H/ L6 y! A group can alternatively be defined directly inside the .rtb file by using the
& h2 I6 s: E% _9 A: t! keywords BEGIN_GROUP and END_GROUP.
, T, }. |" P& V8 |: i!
( k( W2 U6 w' n) j& J( F8 eGROUP customer_group.grb* r# ~9 A; z g
5 f# r" Y" O; x3 ?1 L: i" d# T
! Example of a button that is placed directly on the Ribbon without being, L# ^+ q. ]* Q R" k1 @: P
! contained in a group. This is a simple way to add a button to a tab3 T9 p- B9 n7 G# T4 I
! but is not recommended for many buttons since groups have advantages. J% y3 l# I; S$ L
! & t6 t# I6 S9 C0 B4 n8 S
! A few advantages of groups:. H3 o) h5 M$ q7 Z
! 1. Easier to move many buttons around together in quick customization.
5 |6 u) V9 N- D% G0 Y2 q! For example, MB3 on a group and choose "Add to Left Border Bar". 6 s: n! K, L3 `4 a( G& C+ d
! This will move the whole group to a new location. If buttons are ' B2 G- ?8 F7 J4 p+ A4 n4 v+ r/ m
! not in a group, they need to be moved one at a time.
- l B* I0 C& P!: r. d6 f" M' {" d
! 2. Provide a label to describe its contents.
# b2 Q4 {; y2 f2 t' m!. H- W; q# C' _# e. ^5 U
BUTTON CUSTOMER_BUTTON_1( G8 B6 R7 b# M; I; N
LABEL Button1 Directly on Tab
. L3 N8 U4 R- V9 G8 U) p. B J9 e3 \9 ~& w
1 g% Z( W! q5 U! l4 q
5 @$ l* s" z, {3 P* |3 X
customer_toolbar.tbr( a. s0 m" \" ]) F, g; V$ ]8 k
!
3 [% k& k0 R( i; b: k. ^' s! Customer Toolbar File
/ }1 e. K- H* g6 D9 l, W!: f% m1 L7 ~, D# K: t
! This is similar to an existing toolbar file containing
- F2 }9 D6 K. t! no Ribbon changes.
* r& V! {- L' x!5 c5 O$ J2 _: @- V
! In Classic Toolbars mode - This toolbar will still show up in the 9 ]! O9 ?: I, K" G' y5 V# S2 ]9 N0 y
! toolbars list.6 a% e- b, ]1 E
!7 E+ ]1 c. o8 B" A/ h
! In Ribbon mode - This toolbar will be automatically converted to a
( _; o" Z5 k: ?- {5 B! Ribbon group and will appear in the "Classic Toolbars as Groups"
% g& [) D* G4 |5 Y% G8 U) h! section in the Customize dialog.! x( r) r/ o8 `' m7 U
!
) y2 ^! l: d& ~/ f0 D9 K
6 s* i( ^3 U. jTITLE Toolbar ?# y7 @" K) |* o* \, ]
VERSION 170
* d! T" H$ X1 w. e: P! n9 r; V' I8 l& L
BUTTON CUSTOMER_BUTTON_1
( z. L( s) o) F9 I/ W
a# |* a9 w6 w! EBUTTON CUSTOMER_BUTTON_2
/ ~7 r! U# y# l+ a# }: L7 m# `7 ~+ c9 b
BUTTON CUSTOMER_BUTTON_3
8 Y4 A5 q8 v: y. x1 J- o
0 M9 o7 V$ W- u/ o& g. \! eBUTTON CUSTOMER_BUTTON_41 ^1 D: `* b+ p/ I. S D( P* X
5 [. X/ t; i, B0 o) D. n# t2 O
BUTTON CUSTOMER_BUTTON_59 Z8 M2 s+ { K5 ^8 W: f8 I9 z0 Y
0 `' G" L4 R/ M- A( {
- R& G8 Y% c* \' }! J
$ T& l- i9 k) h. o4 L3 Bcustomer_toolbar_alternate.tbr
2 m# u" e8 ?$ ~/ x# s!
) Q) m" ^; \( }6 j! Customer Toolbar File (Alternate)
9 V- a8 C2 @$ v8 v8 F!( o8 i# x- A4 n. a, m
! This is similar to an existing toolbar file with new3 b) h: g! ~6 [$ N- \, o
! Ribbon styles added., z4 R$ e* y# L8 N9 Q7 Z( r
! Q' W. X6 U1 L/ O$ n
! The RIBBON_STYLE will be honored when the toolbar is loaded
. G5 o0 l* j- ?" U4 W! in Ribbon mode as a group but will be ignored when the toolbar 8 `, @5 ?5 |- t" n$ f
! is displayed in Classic Toolbars mode.
) i$ E9 k( i. q' Q. J0 G: ]!" x7 Z7 t' z" h6 X
! In Classic Toolbars mode - This toolbar will still show up in the
- }3 }. ]4 P; Z; d4 D1 F! toolbars list.
, t/ [) D! D$ v7 X!
5 i" q" N7 O5 e! In Ribbon mode - This toolbar will be automatically converted to a
2 T, b3 V3 j; @' }- F8 I/ r9 |! Ribbon group and will appear in the "Classic Toolbars as Groups". M5 g E" b1 M4 |+ p* _
! section in the Customize dialog.: \6 x( e& v2 w) J, L
!1 c( O% ^$ n( L# c; l k
( w1 ?% C8 e. M& S4 L. V+ G8 }. GTITLE Toolbar (Alternate)
V k; x G8 P3 n% [9 p+ xVERSION 1702 p! v: h( r X6 f% N5 ?
! ]7 h8 Z- |) _! D
BUTTON CUSTOMER_BUTTON_13 W0 y ~+ E* W: O% l* L) R
LABEL Toolbar(Alt) Button16 H2 {0 X7 c/ L2 j# l& L8 M
RIBBON_STYLE LARGE_IMAGE [/ H7 e: Z# V6 n3 H
3 n3 i* C F& {BUTTON CUSTOMER_BUTTON_2
* a0 ^% J+ }, U0 u4 ?! ILABEL Toolbar(Alt) Button29 E3 ^ c# I$ H0 U( O& g& z$ Z
RIBBON_STYLE LARGE_IMAGE* Z/ _' } ]% ~& T, r! J
5 f4 I% e9 C2 n
BUTTON CUSTOMER_BUTTON_3
/ s( l! G/ p( ]& V9 q& FLABEL Toolbar(Alt) Button3" `8 M7 Y' d: O* A2 K
RIBBON_STYLE SMALL_IMAGE_AND_TEXT6 x7 \+ W3 q1 M
* d; K5 U2 j/ j2 s5 iBUTTON CUSTOMER_BUTTON_4( Y4 L' L+ T# x* g# Q' Q
LABEL Toolbar(Alt) Button4
) s- B& W& q3 ^RIBBON_STYLE SMALL_IMAGE_AND_TEXT8 d. @8 s2 y* t- E3 G' R: o
K, X/ F! w: t
BUTTON CUSTOMER_BUTTON_5# R3 ]- Y1 l! j( E! v1 M
LABEL Toolbar(Alt) Button5% a" z* L7 x D! X9 W+ P. r
RIBBON_STYLE SMALL_IMAGE_AND_TEXT. u$ S& c% @* \9 a
8 z$ _* V6 f" g8 G
# N+ S" g. W' r' a
/ ?; c/ U. F: R+ q1 h6 y$ Fcustomer_group.grb- d: W/ ? x$ K2 ?# B/ P! a8 T9 S7 N
!7 d# V% j( T+ H1 c7 ]9 {) T
! Customer Ribbon Group File/ g* G$ j8 c! H$ k$ A0 W( l
!" q# {9 i; b( b5 ?
! In Classic Toolbars mode - This group will be unavailable9 a& r0 |6 E7 ~. W2 }
!+ S9 G& y* L, w; t% E! Z6 L
! In Ribbon mode - This group will show up in the "All Groups" list
: }( O3 s; D: p7 J! in the Customize dialog.
5 J/ f c7 ^" ?& Q9 W!9 b6 }! ]0 V$ G5 |; B
! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files0 [2 F- O' r% \6 w; [- ~) k
!
: y7 n" p& ]# [2 B R& i
4 u& L* F% f5 T2 K% ETITLE Group
- V, Z. ]4 r2 e5 N! s( n6 k/ sVERSION 170: M q- ^& x) k0 d4 F
+ T4 y7 i' t2 y D) q
! No LABEL defined, using RIBBON_LABEL defined in customer_men.men
* I$ w/ @7 R0 u. V& @ ~, @BUTTON CUSTOMER_BUTTON_1
8 @9 p4 A( K N' e) MRIBBON_STYLE LARGE_IMAGE( W- _ c6 o% R+ e) Q, |. u" ?
1 z; @* Z) r/ p! Example of a gallery defined in a GRB file.. U1 M+ a, F/ T" D
!
9 f t. ~4 p& y1 \! If this gallery is to be used in other places, then it could be
1 I; H4 n3 ~* ~5 E+ }! defined in its own gallery (GLY) file and referenced here
7 c( F% x; Q3 E; |0 X! Example:2 |+ B$ j6 q! v. ~; p
! GALLERY customer_gallery.gly
: U5 |- F+ R9 }& o: ^$ t!
# }5 x2 w2 l' {: A+ rBEGIN_GALLERY CUSTOMER_GALLERY" {1 \& ?6 w* l$ t( S
COLUMN_IN_RIBBON 2: M4 N. G& e6 p
COLUMN_IN_POPUP 2
; q0 [5 J- v$ i1 tLABEL Gallery- ^3 i& s- A! h+ ?" k `
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
+ |" c2 p9 d& Y% p: H7 _: a, w. R0 o
BUTTON CUSTOMER_BUTTON_27 h: b t8 T- M( T) c2 I0 d7 t$ ~; n
" A1 P: k0 t& X, ?! E BUTTON CUSTOMER_BUTTON_3
8 p3 C$ Z& g- V* t2 l1 I% G( z5 }: x6 w. j# r! I
BUTTON CUSTOMER_BUTTON_4: T# z7 }( Y# u+ _8 x, A! T6 d% B
# ~2 R+ ^; p9 I1 d. l
BUTTON CUSTOMER_BUTTON_5; X3 ^, J4 k9 u0 M5 v
. w0 h Q7 v! e- I$ |
END_GALLERY
9 E+ _1 h2 q; t$ x4 ?1 a! Z8 b) L/ \9 D
% G6 W; j: J+ ~ |
|