|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧* H! h: w I! M0 }
经典界面到RIbbon界面转换
2 I1 ^) j' s3 b' \, e4 @在经典界面下,需要的文件
( J0 H6 P9 @# U1 R, @1 b* o" e- s- customer_men.men
- customer_toolbar.tbr- h+ C( v0 Q# T% w- a9 e
在ribbon界面下你可能需要的文件 , g' t, N7 D: M0 [
0 n8 s0 K. L+ d8 j# y* ^ a) y! t: K- G
举例如下:, T# |5 o5 T! P7 h( M
7 K/ x8 o. ^3 J- {# b: Q! q2 x8 D
V# w1 Y# x) V+ X7 Vcustomer_men.men6 q# P7 Y* I) H+ G
!
i7 ]6 n3 T; k9 P# F, W; C' x! [: i0 L! Customer menu file; A3 I/ n2 ]( _4 j
! - n; B) H/ k" _* b2 {5 i
! Contains button definitions to be used in ! A2 {4 C! e, ~; ]
! toolbars and Ribbon files- |- u: y' V% a3 O- C N6 G
!( w9 t8 k: Z3 G. \# e1 n& f
) N0 q& c: E- LVERSION 120& e, h+ y0 k& ~
# e# U" S$ `4 { EEDIT UG_GATEWAY_MAIN_MENUBAR
# D, L: `; p: q. e# ] ?; q% J2 c1 v! r! h
TOP_MENU7 H) w8 P+ @* e0 n9 @, j
CASCADE_BUTTON CUSTOMER_MENU
) o! l: K! D2 M& l* |& P8 G LABEL Customer Menu
; T* L0 [% n( {8 |) x+ c7 Z& \/ x+ e& u& o. t
END_OF_TOP_MENU
' s8 g/ c: P$ s! c7 Y
' R2 v& v _3 w# l3 _+ b0 uMENU CUSTOMER_MENU
4 |4 I7 |8 i- N, |1 j( |& O
1 `! Q0 D+ Q! N) [9 p% A9 b/ Z BUTTON CUSTOMER_BUTTON_1* O5 }5 h4 e9 L. g! P
LABEL Menu Button1
* l. A3 w( R$ B7 B RIBBON_LABEL Ribbon Button10 z6 k0 E9 {/ p& t- f! w, }
TOOLBAR_LABEL Toolbar Button14 X; A- K# F, k3 \6 `$ \, ]; o
BITMAP fileopen8 u- a- o8 l" N
2 w2 z f, L+ v+ s4 ~! z% N& R
BUTTON CUSTOMER_BUTTON_2- S" \3 J* L$ s% J( a* j+ N
LABEL Menu Button2
/ [, @$ H- O# j @ RIBBON_LABEL Ribbon Button2. O5 B3 w& { q3 C# A
TOOLBAR_LABEL Toolbar Button28 I" z0 T7 f) v6 o6 E+ ~+ j" ~1 k9 w
BITMAP filesave
, Q9 Y9 m, k7 N! f( ]
: w3 A6 U# I' v, R BUTTON CUSTOMER_BUTTON_3
9 Q% b: {, `- q LABEL Menu Button3
/ F4 o3 p. m" h0 w; A) E RIBBON_LABEL Ribbon Button3
. v, a0 A K% o( s- W/ s' x; d TOOLBAR_LABEL Toolbar Button3
& t: s" e- B1 g& r# [0 X! o BITMAP current_feature G( w8 [0 n6 t |3 }9 R
7 R7 d4 e+ e- U. @
BUTTON CUSTOMER_BUTTON_4 t) r* w/ a6 ~5 Y% \
LABEL Menu Button4
0 V, V, K# K$ i3 |( Y RIBBON_LABEL Ribbon Button4
; H6 q& u: t( i e# b TOOLBAR_LABEL Toolbar Button40 C) r. c8 f. s z, o0 S1 [
BITMAP block% p9 F. X( b; b9 G: V5 e
) u$ J L! _: Q8 s! K$ R BUTTON CUSTOMER_BUTTON_5
3 y3 i/ n4 ~! b5 [ LABEL Menu Button5- U0 Q0 K+ ~' O5 R, O
RIBBON_LABEL Ribbon Button5$ U* }, T8 C4 b# A
TOOLBAR_LABEL Toolbar Button5
: b: l) V! a( y8 Q" \ BITMAP checkgreen
- U; `: a1 h1 D* k3 I) \. b( F- @' a0 ^; ]6 M! o9 k
END_OF_MENU# U' \7 R. a1 Z# t0 a/ }0 p
- a. i0 ?" ?1 H& Q( R0 W7 V7 v, Y6 f
4 @3 _. g( P% Z& x7 b5 a- C; O- Z7 h8 p1 e+ }
customer_ribbon_tab.rtb
% v2 L& R e% ] f0 O3 ^!* T' r5 F7 y: R- {% ^
! Customer Ribbon Tab4 ?% z! O L. V
! 2 ]8 T. t/ j1 k
! This file will create a new customer tab containing three groups and
8 P9 w3 U% l$ Z, q) @! one top level button.5 z% v+ f. d7 L7 N8 b
!
6 B! B" _ L Y& P, C, R- r
, ?. ?! p" o3 l* a# p$ LTITLE Customer Tab
X' S' _' v+ I! n2 r& V$ eVERSION 170
4 h0 H; _ _8 {" M& q" u5 E+ c3 G |7 g* X/ A& Y& C
! The first group represents a Ribbon group that references an existing 5 j+ q% }7 p8 i
! toolbar with no Ribbon style changes. 6 p* V5 b; K- q" N' y- A+ H
!
, b8 N. X/ J1 K( S, z7 n! This is the quickest way to add existing toolbar content into Ribbon mode.' @+ v+ c5 L: Y( i- Q8 H5 H& T$ T
!" X* A& E u# h
GROUP customer_toolbar.tbr: Z$ k o3 Y( m2 y; k
& u9 ]: g, L7 u) r
! The second group represents a Ribbon group that references an existing
* I" v- | q' k. E x4 y3 h5 t! toolbar with Ribbon specific style changes added to it. There is no difference
( e+ b! f0 t! ~# W. |# x9 w2 @; c! in how this toolbar is referenced in the .rtb file compared to the first k+ S X0 o# B6 L
! toolbar as a group. The only differences from the first group exist within 3 Z S v( N9 S) ?2 a
! the .tbr file itself.
9 G+ a, |( J: _1 X3 l+ ]0 A- E!
- h4 z% `9 }2 c! L; z! This approach has advantages for customers that will deploy both Ribbon and
: Y; U* A' E, R$ `" W( e; a8 a0 Q! Classic Mode customizations since all the content is defined in the .tbr
, s" L. `) A/ i9 O! file and it will stay synchronized in both modes. Only one set of customizations
% A% V. ?" Y; [5 l3 m. }! will need to be maintained while still making use of RIBBON_STYLE to 3 O( G7 p6 _- z6 B, @
! control the presentation of the buttons on the Ribbon.& S/ A; b, X) f5 K+ n- o
!7 h n$ t; c6 b. L3 w
GROUP customer_toolbar_alternate.tbr
' x5 v% H- K# B) r; u; g: c% f5 a2 h# o6 v
! The third group represents a Ribbon group that has been created explicitly: a% p& K. T3 z& L% x: J
! as a Ribbon group and will not exist in Classic Toolbar mode. This is the* n1 d5 e! @6 {
! preferred option since the user will be able to take advantage of all the
' b' i2 B) R5 b! layout styles and containers offered by the Ribbon. * B, y4 |1 ^5 e, J* x
!
1 n3 X; P- M1 M, p, ~* ?0 ~+ `( t! For customers that will deploy both Ribbon and Classic Mode customizations,
6 H; ~$ z# b1 e8 U! this approach will result in no synchronization and two sets of customizations
2 g- h- H f; g! k" h! will need to be maintained.! C3 n- {( f8 E5 y" Q0 e: z, t
!
- _+ H' a8 h( G4 B! A group can alternatively be defined directly inside the .rtb file by using the
2 n; @4 Q1 e) t! |0 h! keywords BEGIN_GROUP and END_GROUP.
6 q$ c1 W6 v$ c/ D( _( s4 P/ b!
/ W+ q9 T+ J, x9 }' XGROUP customer_group.grb/ U$ B3 v5 a1 ]2 H& V/ U
5 G( p! X/ c; d1 ?* v( z2 Q$ r7 ?! Example of a button that is placed directly on the Ribbon without being9 i7 `9 z: s V _" f
! contained in a group. This is a simple way to add a button to a tab
0 D7 }7 r2 ^, b! i! but is not recommended for many buttons since groups have advantages.
S c9 ^, N' T+ @. i. x2 U ~2 F! 7 e. }6 ]- a: U, y
! A few advantages of groups:; |& s( z" l# G; a* n9 ?+ r
! 1. Easier to move many buttons around together in quick customization.
4 j0 e, ?" o+ h' \! For example, MB3 on a group and choose "Add to Left Border Bar".
3 X, \3 O/ D0 M/ `0 R8 ]# C! This will move the whole group to a new location. If buttons are 0 I8 B& m3 X4 ]0 w
! not in a group, they need to be moved one at a time.* o+ G r5 O8 i6 X9 x' v3 K
!% g( Y* M7 Q5 _9 K7 n# y& c
! 2. Provide a label to describe its contents.
6 Z9 Z7 I7 d$ u& `- V) ~!
: z) g6 U; U( OBUTTON CUSTOMER_BUTTON_1, K1 u6 U8 C2 f( U) K1 B6 n8 J
LABEL Button1 Directly on Tab
' q' L% Z9 V+ l1 x. v9 _
6 ~' a/ r9 _( I# k
7 w' a! A4 D" z E, A" S; }
* U+ B# F4 C3 n( [7 d: m! |& g7 Icustomer_toolbar.tbr+ D# v+ t$ ]0 K
!
- h, W% K A. n) J% ]7 }( G! Customer Toolbar File
: n: M. c* r) H: ~% ^/ P. W W2 X% K!' L" @. x7 X' D) F. x, u
! This is similar to an existing toolbar file containing o. `) w# j. f q- o) w
! no Ribbon changes." r; D5 U( d$ Q. s( j
!
V4 ?' I; ?, L2 a8 p! In Classic Toolbars mode - This toolbar will still show up in the
- }! N; ^/ R( }$ q! toolbars list.* g7 L* T' I5 T' @, x d8 d
!; _' N* @0 E8 L- N% \
! In Ribbon mode - This toolbar will be automatically converted to a 4 S! Q3 }% \3 B& M
! Ribbon group and will appear in the "Classic Toolbars as Groups" w% i) ]( u" ]
! section in the Customize dialog.9 R: ?# q. U; i
!
4 o" ], V- Z: D" ^) _8 z) M
1 n7 ~* E/ u/ `; p. u5 KTITLE Toolbar
7 C9 U) ]' w- _! ?3 C3 ^ dVERSION 170
( ]/ l3 K! t9 v) {
5 b$ P9 |- t" t5 f. i# cBUTTON CUSTOMER_BUTTON_15 d2 m; R2 D5 @; w
" _; W i: \, l' Z$ T7 f
BUTTON CUSTOMER_BUTTON_27 V$ p( j! k- O6 t
3 T6 V6 Z: o; t D) }" q7 _BUTTON CUSTOMER_BUTTON_3
- Y6 B" I+ K) d j2 [# Y
& c5 a0 b: } R3 Z5 Y" hBUTTON CUSTOMER_BUTTON_4
) a' `: d7 @+ L' Q
- _& d8 {7 W( |& i& O5 A0 IBUTTON CUSTOMER_BUTTON_5: d6 g5 k6 L9 e' E% K
( {9 A9 k ]% p- y/ H5 T }7 S' q9 A. s; W7 t( m
+ u1 ]# w2 |) N# F" ?1 n& z' \6 ]customer_toolbar_alternate.tbr5 T1 `, o. N7 R4 m* W$ A3 a0 v
!
# {; W1 Z( @6 w$ L& R( G! Customer Toolbar File (Alternate)
9 {: p9 k6 E3 y1 V7 u" t% [& `!
; V# I' w! `* }( \) {- b1 @* b% n! This is similar to an existing toolbar file with new
/ R U0 `- }9 h4 `9 C' F! r! Ribbon styles added.4 L* Q w7 z) x1 Z+ W
!
) s/ z6 a5 u( h; o! The RIBBON_STYLE will be honored when the toolbar is loaded 2 {) h" q9 j5 |& h9 b) }- Z& G
! in Ribbon mode as a group but will be ignored when the toolbar 1 } w" @- M/ k: U' b) W4 i, A% y
! is displayed in Classic Toolbars mode.
7 k7 N+ k4 D& D% B5 N!
9 b. W I8 I3 l: X9 R$ A+ u! In Classic Toolbars mode - This toolbar will still show up in the
# |7 }0 m( X% y( g0 u( A! toolbars list.
8 K& K: j( [- a" n, r+ M!
8 x6 f5 K1 |" f! In Ribbon mode - This toolbar will be automatically converted to a ) p: d$ m' ~3 B3 w: q
! Ribbon group and will appear in the "Classic Toolbars as Groups"0 z4 g( M" T" A. d8 j& s
! section in the Customize dialog.
# @* o7 x+ Y1 K4 q' t# \( S!7 U1 x+ ]6 O( @" b7 x3 \
* ? b$ u+ D. ~TITLE Toolbar (Alternate)
. U; p+ j+ C& F: F5 aVERSION 170( L6 u* Q' f5 w
) M+ c7 k/ |# j* X6 WBUTTON CUSTOMER_BUTTON_1$ c* N- L, \4 i2 V5 C* b9 y" H9 Z
LABEL Toolbar(Alt) Button1
. k3 q6 K, l; R* @! U1 cRIBBON_STYLE LARGE_IMAGE
' x. p6 o0 u- l8 ~5 T- ?" ? X( [9 m: j9 }% o* H
BUTTON CUSTOMER_BUTTON_2/ K4 B4 n8 }$ a7 M$ P1 s/ O4 `8 b
LABEL Toolbar(Alt) Button2: Y/ d" H' o& z
RIBBON_STYLE LARGE_IMAGE9 k: T P1 B2 @: g
6 m, v0 o0 c8 O: A; e# \1 c0 ?( T9 CBUTTON CUSTOMER_BUTTON_3( n. F( `% V2 N
LABEL Toolbar(Alt) Button3, _. y) N6 P4 A; { ?1 [8 ^) H9 K! y' q
RIBBON_STYLE SMALL_IMAGE_AND_TEXT8 o2 C& ^1 Q4 A+ ^# V F v
; \ G! h& R& y K2 d
BUTTON CUSTOMER_BUTTON_4
. [8 Y7 h7 K# x% Q8 KLABEL Toolbar(Alt) Button4
" x. ? z: u1 R0 T9 v; xRIBBON_STYLE SMALL_IMAGE_AND_TEXT
) m+ y9 k1 g* ? s: }8 M: K# q
7 z' y$ ^% |3 D4 D5 ]+ RBUTTON CUSTOMER_BUTTON_53 ?. o6 e2 s2 X6 c, I( X
LABEL Toolbar(Alt) Button5; F. r. P0 B5 L3 z. a
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
5 _! X# A4 R5 u- f: @( t
C" D1 _$ k4 P8 `+ u, i0 T x$ \& W
9 [0 F3 K0 g2 `" i X. D+ {3 N1 q) O' j
customer_group.grb
- k) R" U4 _7 m8 ^: j" A8 G4 V!# Y7 `: |5 o% p
! Customer Ribbon Group File
% v8 W9 I! i3 w+ f u7 @$ L!. _7 `# f9 g3 }* y8 j* A& h
! In Classic Toolbars mode - This group will be unavailable1 V3 Q/ B6 E' |8 B
!, m4 y1 R# C6 t: @ `9 z
! In Ribbon mode - This group will show up in the "All Groups" list
; R C- A3 \- \5 \# u4 i: n! in the Customize dialog.
0 [1 M0 d" L, l6 C; [: E" k!8 h- i3 m: q1 J4 E% G' K
! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
% v3 S$ K; n) [: m3 I! h7 _!
& L4 K& @: A: m. B* c$ r& @5 j' ^* H L
TITLE Group. \6 g2 Z) u5 }% A w- @2 n8 P
VERSION 170
% A& o+ Y; D' e4 S8 t$ I1 d; I5 G: D% N
9 y0 @! B1 n9 D2 i! No LABEL defined, using RIBBON_LABEL defined in customer_men.men
" v& i$ R {# P n9 q- w8 tBUTTON CUSTOMER_BUTTON_18 Y# h. k. B$ N: K- M& _) d" ]
RIBBON_STYLE LARGE_IMAGE* a2 i& o3 X& Q1 y. g
* M3 `6 c& J) f' L5 O4 ~9 O
! Example of a gallery defined in a GRB file.2 B1 j; A/ B0 U
! ! K5 V# d7 Q0 V' F( T5 N
! If this gallery is to be used in other places, then it could be
$ C5 H& o5 r- T! defined in its own gallery (GLY) file and referenced here
- P, [8 {0 A5 L0 ?3 F5 Q! Example:1 O! H2 N# @2 I" c1 x" R; _$ M, D
! GALLERY customer_gallery.gly
1 x# X* S: E0 ]& p; l5 n! e!
# j! r0 P, j! ?- d8 A6 p9 CBEGIN_GALLERY CUSTOMER_GALLERY) | _2 [% J4 \1 w; C2 J/ t7 k6 d
COLUMN_IN_RIBBON 2
H/ S1 _* o3 A( z, \ mCOLUMN_IN_POPUP 2/ ?, i g/ {9 k
LABEL Gallery
5 @; W9 x% c t% h% OGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT$ x' w( L* @+ q+ F$ w5 c" W
% N# J0 N9 z9 Z! U/ m6 q5 [
BUTTON CUSTOMER_BUTTON_2% X' t" v: t* w9 `% }5 i6 Q1 h j
y9 R) N) o5 E% ^, c9 n) t BUTTON CUSTOMER_BUTTON_3* L& S! W) C3 O) J; a; e
9 W( e# Y$ M4 X% ?
BUTTON CUSTOMER_BUTTON_4
4 J0 g e6 F) ]8 z/ L4 u4 \8 j5 ?+ v
BUTTON CUSTOMER_BUTTON_5
$ }) }! k0 i7 g5 e0 c. R" q, b( X% i
8 H9 P5 u% r$ fEND_GALLERY! L) B: Y7 C! M
8 ?, p6 r% v. e$ m6 y0 m0 r
* L% ^# @ H" L) V+ n
|
|