|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
4 P! w! w, v2 h2 p; G
经典界面到RIbbon界面转换
3 C" s0 @5 \6 |, L# Z在经典界面下,需要的文件! d( m4 }6 L! m& q1 r; X! q8 s7 w; g
- customer_men.men
- customer_toolbar.tbr
; D, \9 [/ P6 g& O7 ?/ L, I 在ribbon界面下你可能需要的文件 3 u) e+ S( ^1 S' V8 K# M- U- t
8 {& y( l( A/ L A7 d
- Q. K$ Z$ N; V$ X, t- h9 P2 A3 U
举例如下:) k8 m( ~ u' ]
% p# b+ w3 q8 A8 h4 c5 B0 J, g
9 V! F9 G {" b9 m2 |9 ]0 L4 Z3 }customer_men.men
8 d" S4 ?. r2 H9 m' g0 C!
) c4 g( o7 }) w! Customer menu file$ I g" R2 x0 X
! 8 l4 Z/ K8 z8 h' h6 S( {3 q& }
! Contains button definitions to be used in
# w; p8 [; e6 Z+ v4 q* }( j! toolbars and Ribbon files
: K# L" ?' y/ }; D; e$ t5 h; r!! a6 p7 ~6 g! J6 E
1 V" v: o5 Q% g! Q( Y3 n( ~; l2 }VERSION 120
7 M2 U1 U ?, Z' D4 [ q. L+ l- U$ l Q; Z9 R0 c7 e
EDIT UG_GATEWAY_MAIN_MENUBAR
U8 M. i7 Y' Q# U6 `7 e: g8 q% j' ]( H4 z
TOP_MENU
# M% P" }+ c; | CASCADE_BUTTON CUSTOMER_MENU/ ]: Q4 o% r. ]
LABEL Customer Menu
9 g8 h! H/ O' x9 S2 {9 ?/ F
7 u8 g- l- X F: I- hEND_OF_TOP_MENU
{ g5 H9 ]8 x/ X4 c2 l0 R1 U" f3 E- X& E; M
MENU CUSTOMER_MENU
6 e5 @3 i3 I3 a3 a
- d. h* `% T. Q: i% ~ BUTTON CUSTOMER_BUTTON_1& m8 w5 k7 r0 \( _# C+ T9 x
LABEL Menu Button18 C+ t: O/ ~: O c
RIBBON_LABEL Ribbon Button10 [* m2 k3 q3 N2 V
TOOLBAR_LABEL Toolbar Button1
( P1 @/ j) q9 K' }+ R6 ?8 S BITMAP fileopen( t% }- {0 K! n' o! G7 i# \/ Z
/ v$ S& x6 x9 T
BUTTON CUSTOMER_BUTTON_2: h$ W: f! L' n! @' C1 _
LABEL Menu Button2
- g( \; G6 v# Q4 n; d. i/ w, ^9 Q( A* N RIBBON_LABEL Ribbon Button23 o' a8 c! ?+ o
TOOLBAR_LABEL Toolbar Button24 t1 G8 K: l6 o5 y" |" ^3 n
BITMAP filesave
0 D9 O# `, P: \1 z1 v+ j( f* r1 Y, \
BUTTON CUSTOMER_BUTTON_3
! X# K3 z1 I# I( p6 o% M LABEL Menu Button3% ], T, x: F3 |/ {8 C
RIBBON_LABEL Ribbon Button3
( b! p5 K' {& T TOOLBAR_LABEL Toolbar Button3: w- q3 n( x" V) s& p2 K4 ~
BITMAP current_feature
7 f/ z, q8 }- |1 B- O
4 `, [& r+ A" ~4 X( t8 d BUTTON CUSTOMER_BUTTON_4) c- i- B0 v4 ^% `
LABEL Menu Button40 G, h2 n0 \+ L
RIBBON_LABEL Ribbon Button4
4 i! p1 E: w& X3 K' i TOOLBAR_LABEL Toolbar Button4
, q$ h7 {: q5 u! H4 c6 I BITMAP block
. ?- s: o$ F) x2 ?! z. X R; Y8 D% Y( I6 v7 k; z! Z1 k
BUTTON CUSTOMER_BUTTON_5
0 _1 f8 X* }5 y: v LABEL Menu Button5
( \* u2 J* B7 A& q8 G! ]6 |7 ~5 { RIBBON_LABEL Ribbon Button5. ^& v6 A( n1 F, M( |, j
TOOLBAR_LABEL Toolbar Button53 ^7 g! A& M: ]) @* R
BITMAP checkgreen* Q, N. J+ Q! C' O& s O
8 U) o2 S1 |6 ]
END_OF_MENU
+ m- y* F4 j5 s7 N3 X: c& Z1 p% |
5 P/ Q, C8 p a5 _
9 t8 p9 Q3 S6 o4 w# i- x0 Y3 i1 ]2 b/ r
customer_ribbon_tab.rtb4 F, @" p& G1 ]
!% z; N, w p: `5 C
! Customer Ribbon Tab# f2 J2 P' O6 O2 G( o$ n
!
7 h; ?% n Y$ q6 ? i Z! This file will create a new customer tab containing three groups and3 z1 p8 V7 z6 s# y: K5 a, H0 \
! one top level button.- p7 k5 T% o4 ~8 o7 h
!
* `& s k+ Z$ g7 I/ t( V7 @1 Y: O9 }, T r7 d9 X+ I
TITLE Customer Tab
9 e5 {! u: b2 RVERSION 170
( u9 o7 |8 a& p6 v* c
' Z& k4 `5 ?3 p5 M4 {! The first group represents a Ribbon group that references an existing
4 X! k" w0 p) K/ n- ^3 n! L7 t. @! toolbar with no Ribbon style changes.
1 ?, K) t' D3 r; a!
" r6 z4 j, r' g( r/ q2 Y" E- S! This is the quickest way to add existing toolbar content into Ribbon mode.; r/ O- |. x; k
!3 Z4 f7 K+ L }
GROUP customer_toolbar.tbr- J9 P @& t- g; m
1 M4 u: I. g& W- X' {! Z7 K! The second group represents a Ribbon group that references an existing & f1 \" ^& i* u5 y5 G8 i9 H
! toolbar with Ribbon specific style changes added to it. There is no difference6 {7 G2 C/ P* K" B) i0 R2 y1 j" F
! in how this toolbar is referenced in the .rtb file compared to the first) p$ g3 ~, H# G% p% B$ n8 r: q! ]
! toolbar as a group. The only differences from the first group exist within
7 I, ]+ @4 z4 e$ U! ]! the .tbr file itself. ~7 K; t9 R! g) x( r* u
!% k/ K5 ]* H# V- I8 a
! This approach has advantages for customers that will deploy both Ribbon and8 k+ h8 d( i9 f, f7 R! A4 k
! Classic Mode customizations since all the content is defined in the .tbr ; M8 E" ~6 D7 I* N" x( t
! file and it will stay synchronized in both modes. Only one set of customizations
* y$ Q6 S( Q7 @7 ~& k% V! will need to be maintained while still making use of RIBBON_STYLE to k! R) j5 T% z U
! control the presentation of the buttons on the Ribbon.
1 |8 E/ v/ @! R' D' {5 K+ g!
4 A. Z) P9 o* p- eGROUP customer_toolbar_alternate.tbr
/ f/ [5 D4 C4 L, W0 L* Q9 l% T9 e3 A% t% {2 B& f# H* {# C: t2 N
! The third group represents a Ribbon group that has been created explicitly9 L) |3 |$ r1 M! I: g
! as a Ribbon group and will not exist in Classic Toolbar mode. This is the
* g" `/ m, g& ]. L) I: D! preferred option since the user will be able to take advantage of all the
, t- _$ M; p: A2 }/ k! layout styles and containers offered by the Ribbon.
& N9 I% ~* U$ P; r( I- v9 q7 p6 A!
4 c7 S; D% f4 N, V3 K$ a( s! For customers that will deploy both Ribbon and Classic Mode customizations,
' ^3 c4 y# i- y6 q! this approach will result in no synchronization and two sets of customizations
% S+ h6 L% y. x2 f" s9 E) f; Z! will need to be maintained.
2 f5 B9 a q; j0 q; j9 i! ?, f$ _6 g6 R! Z/ R. G" K
! A group can alternatively be defined directly inside the .rtb file by using the3 K2 A4 ?. v5 C, w
! keywords BEGIN_GROUP and END_GROUP. ; c/ r6 ]( K( f' \) ~
!
5 P. a5 ]4 v% jGROUP customer_group.grb
" ^$ A7 }/ D* N) n' P8 V
9 H) P/ N- h0 y9 k8 \5 R3 e/ C8 o! Example of a button that is placed directly on the Ribbon without being
4 i: q1 j0 M8 u: I& n$ K8 d4 J% B# n! x! contained in a group. This is a simple way to add a button to a tab
6 J7 _" I; C4 H+ K3 S! but is not recommended for many buttons since groups have advantages.1 n$ w, e/ g; Z) Z' Y2 \8 P
! ( N3 O/ U8 ~* Q, P) T/ y7 a, b9 f
! A few advantages of groups:
! R; f8 X8 m7 Y* t; {+ T: v! 1. Easier to move many buttons around together in quick customization.
1 _9 t. [; A$ V6 _! For example, MB3 on a group and choose "Add to Left Border Bar".
' V% G7 c; m3 L9 _! C2 j! This will move the whole group to a new location. If buttons are 2 j' U; T) y) A' m7 j3 c
! not in a group, they need to be moved one at a time., l4 E( x! }4 \ L: _, `
!( k3 @7 k' j+ J
! 2. Provide a label to describe its contents.
. ]# Y8 ^# I" {!& j b& b5 k+ `) x0 q0 f: [, t" S
BUTTON CUSTOMER_BUTTON_1& W! D$ Z) L( D0 k
LABEL Button1 Directly on Tab
/ @) v' G# i* \" G0 A% y; K7 A
' r3 V$ {' F$ _3 L. L
& V% m0 L. g/ |& }# L ?
customer_toolbar.tbr3 [$ D! `" A4 N B4 }
!" v+ n- s7 p/ I+ P5 j
! Customer Toolbar File7 m: t0 K; v5 V o6 y8 t
!6 b2 {$ L" O/ q7 P7 I
! This is similar to an existing toolbar file containing
2 b+ C" }: M: M! no Ribbon changes.% U4 P) J' G8 {; v1 {* g5 W2 ^& r
!- ?% v8 p) @# ~# W/ X/ N+ B) u
! In Classic Toolbars mode - This toolbar will still show up in the 9 I2 M K: @8 J
! toolbars list.6 L3 r& y3 q2 q- ?& O) s
!" B3 c; Q$ o, e3 G$ I) @" c
! In Ribbon mode - This toolbar will be automatically converted to a & I$ b/ m- a5 ~4 J" t7 `. K& f5 |( H' K5 {
! Ribbon group and will appear in the "Classic Toolbars as Groups"
$ S F5 C4 b0 K$ b5 r0 g! section in the Customize dialog.
9 r0 d9 c! @, _& X6 S* A- U8 R! . }. b" R' ?7 D w0 K% D
' ]/ e3 I h' M% j+ ]3 a" p
TITLE Toolbar/ f1 V% ]& F8 r! b8 |
VERSION 170) F1 E* w( R& x- q2 z3 _$ ^
/ A' l) J0 Z% n% ^& w6 wBUTTON CUSTOMER_BUTTON_1( L* L# P( E8 k k: @
+ V4 p$ H8 L _) \
BUTTON CUSTOMER_BUTTON_2
. W. X- v3 d' U" K3 G, L3 w& K) f# [! F
BUTTON CUSTOMER_BUTTON_3& S3 M- A g: N, E. K5 V
4 T8 l7 y- }. U0 k0 |. GBUTTON CUSTOMER_BUTTON_4! A6 j T9 ~! N3 s: q; l9 B
- \; _$ O' P- ?+ XBUTTON CUSTOMER_BUTTON_54 w, v. i, N; g; J) i0 z( f
1 R! ~& G1 y* M; N/ B
% P- J4 A" ]5 d. ^( H
, ]2 F4 F& Y' k H1 O: O+ |customer_toolbar_alternate.tbr* g0 U0 }4 _4 H8 H3 [. Q
!! \# f/ ^! ^' [+ V* Y; u1 h2 a
! Customer Toolbar File (Alternate)" l, `+ C S3 @: `4 f$ a
!
$ d* T5 f7 S: u) R {: o! This is similar to an existing toolbar file with new1 j: U8 J' g) a
! Ribbon styles added.
2 k e7 q' t* t/ Q$ e" {5 ^!
( E3 ~' F( x) V& u! The RIBBON_STYLE will be honored when the toolbar is loaded , S! P+ U+ w$ U" l" P x* ]
! in Ribbon mode as a group but will be ignored when the toolbar
" X4 k, \$ i3 F8 G4 ^! is displayed in Classic Toolbars mode." r# P2 U8 i) C: P$ l3 A9 _
!, u" m# z# c! s6 O. z% y' y4 I6 c
! In Classic Toolbars mode - This toolbar will still show up in the 0 x% N2 _9 R2 {$ Q
! toolbars list.
/ L: ~! C. a6 p/ z!
+ C+ `/ P) N- j& o2 t) v, v! In Ribbon mode - This toolbar will be automatically converted to a 5 [; |, n) [5 [3 |
! Ribbon group and will appear in the "Classic Toolbars as Groups"
2 s( p3 C) c' e/ _! section in the Customize dialog." d+ A4 B" }; q: i3 _: J. l2 z& F; X4 B
!
6 v' J- R6 {* o( z8 h' z, G0 n2 _
2 U' W& D0 n7 C$ QTITLE Toolbar (Alternate)
: j, j6 o# i+ bVERSION 170
$ I! o U% r/ N* c! m3 N0 n4 c
) g' O8 [' P8 y6 O6 C: uBUTTON CUSTOMER_BUTTON_1
/ |. f, K" F- BLABEL Toolbar(Alt) Button1) u+ i8 S7 z% a8 c3 e3 M0 E
RIBBON_STYLE LARGE_IMAGE
; q2 l" u/ ~: [ f1 H B; e" p0 f
& v2 l# X: s) O! R' g; kBUTTON CUSTOMER_BUTTON_28 E5 M$ i% G4 d# s: Q. M; U
LABEL Toolbar(Alt) Button2
# P7 U& ` w+ W5 SRIBBON_STYLE LARGE_IMAGE4 M+ t0 X1 X3 b8 [& C& N' ?
1 z: Q1 x9 {9 ^+ |) h* l: s6 [: ZBUTTON CUSTOMER_BUTTON_35 s/ m& V" D6 S
LABEL Toolbar(Alt) Button3
' ?: N! u- s1 q/ I6 s- r: Z& oRIBBON_STYLE SMALL_IMAGE_AND_TEXT) d H8 B8 O' a5 X+ H! e" e
7 L: k/ y. @1 s. gBUTTON CUSTOMER_BUTTON_4
3 d/ Z( S0 O% M# t9 ~LABEL Toolbar(Alt) Button47 S3 F7 \% o4 K. ^ a
RIBBON_STYLE SMALL_IMAGE_AND_TEXT) C( @$ k/ v+ {5 Q& g9 {# s: i
4 o$ h! J" m( s @8 W. YBUTTON CUSTOMER_BUTTON_5
+ K% _# k6 _, z3 Z: W( hLABEL Toolbar(Alt) Button5
m' D4 w/ j0 I P% oRIBBON_STYLE SMALL_IMAGE_AND_TEXT
; p2 |" v6 w$ M9 {. m2 Z/ t' v
F- x3 ~: A6 ^' E! r. N1 M
' E; z9 A0 b* ^. B' B& W" q# R
3 k' Z. t' d. r. ~customer_group.grb
}2 G- ~1 Y! o( [5 X!
x& ^6 {3 y. K, i0 T$ Q$ C! Customer Ribbon Group File
6 I5 J4 }6 T; `8 G!
) \) b- T1 z& u1 h1 j! In Classic Toolbars mode - This group will be unavailable
- ]0 \ E% \0 K3 A* @ C0 F!
' [" R4 ^) P3 v) i! ?% j' H' v: A! In Ribbon mode - This group will show up in the "All Groups" list
- k' Z7 x$ W- O: s+ q( _0 m! in the Customize dialog.. H8 z7 B( O: M# m8 g
!0 \( L5 ^4 B$ N. G' m6 D0 \! }
! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files V3 `/ c. S# @: ?$ x1 p# X
!+ m# T: B2 \0 A5 ]9 k% V
" g# g I1 ?2 ~' _* {- o
TITLE Group- l" X& {2 b! `% P
VERSION 170
. U% |+ N1 ^- O$ d. ^( @; q
0 p2 f7 F+ t9 {) _. y2 g' I! No LABEL defined, using RIBBON_LABEL defined in customer_men.men
/ G4 l3 K% t- LBUTTON CUSTOMER_BUTTON_1
# y: c3 ?5 M( r0 b3 T$ xRIBBON_STYLE LARGE_IMAGE
# W* V: ]3 m: ^: ~ d2 I8 i" M8 K \' C
! Example of a gallery defined in a GRB file.- a2 B) i* j Y
!
* d4 B" k# z0 k& s! p! If this gallery is to be used in other places, then it could be $ Z8 }9 e5 X q% J+ w- b% u
! defined in its own gallery (GLY) file and referenced here
% c, \' f% e* P [$ d& ?! Example:
4 _& ^+ p) s2 j- T! GALLERY customer_gallery.gly
! a E+ I J1 z6 W!
/ h" t5 g" b, ?; ?. hBEGIN_GALLERY CUSTOMER_GALLERY
% ^+ z& Z7 R! a$ i0 N1 mCOLUMN_IN_RIBBON 2: X R( P% i4 u
COLUMN_IN_POPUP 2+ g, X9 Z! H. {; a! e$ r
LABEL Gallery
* [, c5 J. l# I1 U8 @" xGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
6 L$ p7 p8 p$ @+ C1 v) k1 c' r' |, ` H. T+ ^
BUTTON CUSTOMER_BUTTON_25 D" V8 z/ E: ^
2 Y5 M: m3 H1 N. y2 Z* @! d BUTTON CUSTOMER_BUTTON_3
' P+ z/ Q( g) Q$ s B9 i6 u6 P1 P
BUTTON CUSTOMER_BUTTON_4
) x1 a4 Y* Y) p& c) a; Y% N
3 o1 U. H. t$ p3 m BUTTON CUSTOMER_BUTTON_5
: f8 M. U. V: H
6 u5 p8 X3 H' s; R1 JEND_GALLERY
- E/ @% Z) s9 u4 u8 c4 g% s; T
, Q$ }2 q; I' L; P2 X9 W
2 @' r) ~+ g @" O$ F& Y |
|