|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
' |/ K$ d5 b4 j: D4 x
经典界面到RIbbon界面转换
5 F5 i Y, N& I& z
在经典界面下,需要的文件5 V( ^( }' U7 k7 g
- customer_men.men
- customer_toolbar.tbr
: C% {% V8 p" L, ]' g 在ribbon界面下你可能需要的文件
0 E$ K2 j3 [0 u1 f
7 l+ d( E9 u+ T$ }; ]- B. D+ O8 [
举例如下:$ E, y7 E; Z0 g
6 B% z2 g- G# k2 ~' `9 q' V9 ^: p. F. g
5 P! G8 ?% Y# W0 R6 Y+ b% L Qcustomer_men.men
/ O6 i2 Z' K @$ C6 x3 h!1 G& }! B3 c* C- T3 C
! Customer menu file
. H& _8 V4 B7 q: [% K!
2 T6 c |1 x6 x! Contains button definitions to be used in * b+ }1 b8 F/ X% h$ n
! toolbars and Ribbon files
: M: q2 z5 x" u6 {# n9 G!
# X. L4 W8 s2 E8 \
, o" Z$ q2 h) `; x* h4 hVERSION 1205 e$ f8 ~2 X, S* h
" a' w: _3 q0 ~* T( R
EDIT UG_GATEWAY_MAIN_MENUBAR
( ], t" a; `' s9 n3 S! ?$ @9 W- i
; M% F/ G3 S, A. x/ G3 UTOP_MENU7 m, r: h- y: s; y# h* T
CASCADE_BUTTON CUSTOMER_MENU9 F x* A) }% `9 A ~
LABEL Customer Menu) a1 l& j3 B$ P9 g
: u0 q% Y. B5 d, p+ }( q9 uEND_OF_TOP_MENU7 a5 }4 O' ?' V( L
( W: E3 c* ~. P+ p- h( LMENU CUSTOMER_MENU9 ?5 E5 ~# m* E; A+ l
- R" S4 \9 L# Q$ T/ F" g1 t BUTTON CUSTOMER_BUTTON_16 ~$ ?" O* b8 S- b, Y
LABEL Menu Button1
. k5 ?- G8 f+ X' Z8 T RIBBON_LABEL Ribbon Button16 q+ A' p( u! o: Y& {/ N; p
TOOLBAR_LABEL Toolbar Button1/ P- r% e# F) N
BITMAP fileopen$ }* T5 Q6 ?* c! {
4 y. s) i ~& b! t9 d
BUTTON CUSTOMER_BUTTON_2+ O, U1 F7 \, e; {3 A" W
LABEL Menu Button20 ]" V9 }8 h4 s7 D. X
RIBBON_LABEL Ribbon Button22 Y9 |. n. }4 F5 f( q
TOOLBAR_LABEL Toolbar Button27 ^6 a% t; I3 A3 ?* d
BITMAP filesave5 T/ C9 {& G$ C) U6 H( B
* f) M0 \6 M( m( z, x9 z. @3 o BUTTON CUSTOMER_BUTTON_3
1 w3 ^7 w4 O1 e! v* p! h5 i8 `9 w LABEL Menu Button38 U! l0 l+ v% o0 Q% {
RIBBON_LABEL Ribbon Button38 u/ N7 P' C3 E9 j- C/ V, a
TOOLBAR_LABEL Toolbar Button34 ^7 T' x; J# R2 i# Q R' Q
BITMAP current_feature! C- Y( h6 k4 B% L7 ^# l4 G
) Z: J$ i7 ~8 z1 k) m) n! I
BUTTON CUSTOMER_BUTTON_4
( D5 [* e+ Y1 \0 F* `! v8 Z0 o5 z LABEL Menu Button4
' x! N; f4 w D i1 H RIBBON_LABEL Ribbon Button4
, H! k) X5 A# y1 B) d& q: g TOOLBAR_LABEL Toolbar Button4
2 Z- N: x2 v$ c BITMAP block
, r! x& `, @: t w% l
& k3 `5 t; u! _! X t6 V/ I7 R7 M3 q BUTTON CUSTOMER_BUTTON_5
+ @' `! j4 C( V/ W LABEL Menu Button5' c4 F) I7 ^1 |0 C4 n
RIBBON_LABEL Ribbon Button5
, }; ^( ? J% [/ d8 ^" s4 o TOOLBAR_LABEL Toolbar Button5
( m7 ~8 L6 I8 z+ ^) z BITMAP checkgreen
; p( w; |! J& ~5 l: e( x+ `, a) q* F d e, r
END_OF_MENU
8 F& E& F+ Y& Z; `( ]& e
' V' A! w+ e& R2 b& c% L& T; \! c8 F
: w/ I2 C! u H6 [5 E/ ncustomer_ribbon_tab.rtb
( d1 h4 S- b P1 S) J0 _, s7 m!2 }& n& z1 u* ~/ [- l3 R2 W
! Customer Ribbon Tab8 y, Y9 A6 N4 M- x( z7 Q O; y
!
4 {: Q9 ^0 F0 b( t) m2 R2 p# }! This file will create a new customer tab containing three groups and
# s/ o ~ R# P2 @9 G7 F- q% T: y! one top level button.
2 v, p. W+ r# T+ B& J! h+ R6 W8 `8 ?% d
' j* Z- z* P( p& a- u ?2 ~TITLE Customer Tab+ E7 i8 m' g% W9 O
VERSION 170
' S i) d* l3 }* l' f0 e% F2 Y' Q( V' r. s8 a9 g5 o
! The first group represents a Ribbon group that references an existing 4 T/ q* J3 P$ g6 C
! toolbar with no Ribbon style changes.
. d# _- B7 K* { I6 Q!
2 T! s/ K: x8 M* d% e& w! This is the quickest way to add existing toolbar content into Ribbon mode.
) b- u8 x y" u6 |!
: Y+ i; F$ t# tGROUP customer_toolbar.tbr( @1 h3 ?, q) o
4 ^1 ?/ E2 n4 V1 g3 l$ V! O4 T! The second group represents a Ribbon group that references an existing
# k. @/ e, F$ M. I6 \! toolbar with Ribbon specific style changes added to it. There is no difference% x& L% K& n9 x' ?% p* E; C
! in how this toolbar is referenced in the .rtb file compared to the first
) M4 e% F D3 h: B! _2 k4 c* j! toolbar as a group. The only differences from the first group exist within 4 v7 D- [+ b9 Z, i
! the .tbr file itself.% {$ b1 ~0 B- @" o! r
!
% b' F/ \( a/ ?, n6 @! This approach has advantages for customers that will deploy both Ribbon and
8 a9 M" D( E! b, K! Classic Mode customizations since all the content is defined in the .tbr
+ b& k! Q$ |, A9 H: t, Y9 k$ P9 ]! file and it will stay synchronized in both modes. Only one set of customizations
" B4 @0 t) o& j9 }1 |! will need to be maintained while still making use of RIBBON_STYLE to : O* Y, \6 c% B+ r/ c6 }
! control the presentation of the buttons on the Ribbon.$ X) J. T8 ?* `6 a/ t
!
+ T! O4 z) A7 }6 p0 e' v$ EGROUP customer_toolbar_alternate.tbr; `4 v, k* G, B& v: A+ w
" r+ e4 Y- `* h" z! The third group represents a Ribbon group that has been created explicitly& y9 f; }0 [" w+ P
! as a Ribbon group and will not exist in Classic Toolbar mode. This is the* Q3 a9 a3 d! w& U# g2 z6 S
! preferred option since the user will be able to take advantage of all the 7 p1 \, [* {* |. f" e# g0 |) L% c
! layout styles and containers offered by the Ribbon.
G4 r7 p1 ?1 ^1 {+ b!" M" m# Y% m4 L# o8 T2 p$ {' C
! For customers that will deploy both Ribbon and Classic Mode customizations, 4 d/ d0 u- s! h: i: l
! this approach will result in no synchronization and two sets of customizations , n$ s% k8 M0 G9 j# q; e# ?$ |! Z/ p0 x
! will need to be maintained.
7 J; i. H: D6 j!
/ w% @, [ ~: n# [ e; r! A group can alternatively be defined directly inside the .rtb file by using the
5 B/ ?: P5 _$ m5 X1 T- X) q! keywords BEGIN_GROUP and END_GROUP. 6 y7 o$ ~# s( R# K0 P
!3 J% T3 @: c" O) n0 k! D7 N
GROUP customer_group.grb
% Y; k/ k r2 c0 T' _( a* e0 e+ i8 {
! Example of a button that is placed directly on the Ribbon without being1 Q. Y! U: W$ G* L s$ Z! E% U( Y
! contained in a group. This is a simple way to add a button to a tab
2 V, H& y) L; x9 O. V" t0 u$ M! but is not recommended for many buttons since groups have advantages.$ K; {+ v3 V7 J) q9 j( w+ A$ e+ y
!
1 `5 y0 @$ K: a2 D" J; [/ T1 M! A few advantages of groups:. S. f' w* D- k2 J( d* y
! 1. Easier to move many buttons around together in quick customization.
: H7 w# T! t6 o9 r5 D! For example, MB3 on a group and choose "Add to Left Border Bar". # G% z. K/ T) ~: n U
! This will move the whole group to a new location. If buttons are
9 Z! b! j& J4 D. T; f- X! not in a group, they need to be moved one at a time.9 {! g' z: c+ V' q( }$ g0 s
!' h( o2 R: s3 u# r- l0 p4 W
! 2. Provide a label to describe its contents.
& {4 l6 `' H2 O5 K' D& k' `! R( b!
2 @0 k+ U. o# C, a6 tBUTTON CUSTOMER_BUTTON_1
' ^! L5 J; m# N( ~1 d; HLABEL Button1 Directly on Tab
/ ?$ x+ h8 d1 x; O# i( {: s9 V& E- W# Z# W+ G. m( G* V
m6 n' P' Y; D) x" a3 O# \8 p+ n9 S6 r* s( ]% {
customer_toolbar.tbr
6 d" Q& @' N" |5 i+ M" y5 f!
2 \: z4 K7 c0 q8 ~) t; T! Customer Toolbar File
% Y* `7 ^) w2 O0 M/ u, }8 {5 y0 ~!) q7 T, d7 @8 x# r
! This is similar to an existing toolbar file containing
- J8 j0 J2 ^4 E5 o2 F! no Ribbon changes.' W0 ~! A4 ^. [3 O; s; [# m
!
9 D A: F4 J9 {, W- Y! In Classic Toolbars mode - This toolbar will still show up in the
+ `$ V0 s' C5 M- }, J! toolbars list.+ g7 b# j* ^2 P* W1 e# v- C; D
!% C! H2 s$ \7 e5 Q( V( `
! In Ribbon mode - This toolbar will be automatically converted to a
2 v% L2 W; Y- n( b% |8 {: P. N) a! Ribbon group and will appear in the "Classic Toolbars as Groups"5 V1 j: k3 k) [* f( }* i. o6 ~
! section in the Customize dialog.! a& H7 S" u& e9 W' s6 L
!
( ]- T7 O' [6 S9 @/ d! M F( z- o; ~- q3 u" r
TITLE Toolbar
8 p* c" T) r3 s, h4 ^' ?4 s0 RVERSION 170
3 N+ a6 T% d4 A, @7 N( u3 L
( ?0 ]: @* B: d) ZBUTTON CUSTOMER_BUTTON_1
$ J" E( O; H% E4 R3 t. X" l& F! M0 Z9 f8 y$ l
BUTTON CUSTOMER_BUTTON_2
: A5 I: F, K6 d7 h9 N; u
0 u1 d, a8 L- QBUTTON CUSTOMER_BUTTON_3/ b5 E( A3 t+ [; b
* H0 l# G% J$ v) R
BUTTON CUSTOMER_BUTTON_4
5 B% J5 |: F/ g4 y7 ?1 a# [* {; }9 I
BUTTON CUSTOMER_BUTTON_5
/ d) K/ x2 v/ U) ]* ?* X; ?
2 n" X5 U4 h2 H" }# N* a
# q: z( J A L A
2 x! }3 g: K+ Y. u+ A2 k5 w: ecustomer_toolbar_alternate.tbr
. \" ~* K# l6 C I$ H" ]!5 y8 g6 R" T; J( n+ p" R
! Customer Toolbar File (Alternate)3 Q0 }! m( c; P
!' I- _! j X* A3 ]
! This is similar to an existing toolbar file with new
' r& J5 c: c8 z w! Ribbon styles added.
" g8 P$ U' Y; `, u9 g* a, f. n! . |, z2 G' q) q6 e1 j: M! C; ]! o
! The RIBBON_STYLE will be honored when the toolbar is loaded 0 C/ ~2 _5 x3 Z' W/ H
! in Ribbon mode as a group but will be ignored when the toolbar
$ i- O; L& X4 h! is displayed in Classic Toolbars mode.& u% N) v. B+ m( ^+ H/ r" H0 B5 x
!- k% m4 T# t$ h. l
! In Classic Toolbars mode - This toolbar will still show up in the
$ f+ a: s! b- V8 j! toolbars list.) t5 j2 p+ N1 ?& p
!) d% {- B2 \( p% Q: O0 Y7 ?6 Y+ y
! In Ribbon mode - This toolbar will be automatically converted to a , e, ]8 H: i: O' ]' A1 H7 j
! Ribbon group and will appear in the "Classic Toolbars as Groups"0 |( w+ S' t& x' V& H; @8 |
! section in the Customize dialog.( j+ g# [, {8 p( u8 J$ B
!+ G# w# n9 k% L; L
( P* O+ W4 q2 ?5 yTITLE Toolbar (Alternate)' W: g) v( G% I" i' G% k7 M
VERSION 170
/ ]1 k& G1 _: P, B5 Y# v/ b- f. V6 ?6 w4 h$ B% E. x5 R& ^ o
BUTTON CUSTOMER_BUTTON_1
* L4 p A2 x0 A7 lLABEL Toolbar(Alt) Button1
2 x+ S$ V* \4 n: @- e% _) \* wRIBBON_STYLE LARGE_IMAGE
8 \! ~2 |4 v1 O& w/ q- a2 {* G4 I3 ?1 S6 [# D s
BUTTON CUSTOMER_BUTTON_2
- M6 ^2 X9 E. u; t/ P/ y) sLABEL Toolbar(Alt) Button2
! q9 R* d' ~0 B, Q+ \RIBBON_STYLE LARGE_IMAGE
) n1 H' K9 `0 O% K8 F0 m, ^) l; m& x% X( Q$ N
BUTTON CUSTOMER_BUTTON_3
! J) r' p. ^2 z$ n* ]LABEL Toolbar(Alt) Button3
2 {1 D, S! |- F# vRIBBON_STYLE SMALL_IMAGE_AND_TEXT3 ?) P6 d6 `, s7 T
6 N& c5 x0 z% }# M- l
BUTTON CUSTOMER_BUTTON_4
" ?% v& K7 V1 y4 u# C- l3 iLABEL Toolbar(Alt) Button45 c# J/ y% `& v
RIBBON_STYLE SMALL_IMAGE_AND_TEXT0 V5 ^ @$ q- g. J! a4 Z8 o
# m" t: M! W1 L$ U9 _6 iBUTTON CUSTOMER_BUTTON_5* I/ D! Z3 e; Q( h- y, r! n ?3 C. B
LABEL Toolbar(Alt) Button5: r9 x2 g9 A: S* h2 H5 L
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
8 ]& ^3 x6 Z; I5 J& `5 l7 x, @
. T0 o; C. n5 i$ E( W' ]7 C% |
4 ~2 R X2 `8 B6 d; |" e8 x* B+ s, o6 ^6 r/ I9 j
customer_group.grb
6 p/ h( o, L9 ~% r5 C1 n1 N$ m!: {: L' Y3 ~+ }: t- g/ g
! Customer Ribbon Group File9 X' s7 F/ y3 j8 @. h! v, U
!
5 I) F( Q) \/ t9 d) y. G7 e% U9 u! In Classic Toolbars mode - This group will be unavailable8 R0 y" a" x4 v E0 ]
!
% W& v4 d' k$ t+ I) ^! In Ribbon mode - This group will show up in the "All Groups" list
1 `: h: o9 V/ \6 ^! in the Customize dialog.
" A p. Z0 }: J!
2 W/ c6 s9 [* @ q( }! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files+ u V: g, F' \! @
!
3 s9 B& W! l( u3 F" e8 i5 b" f. \8 Y
TITLE Group2 v5 |: z: @& s; L2 Z' }
VERSION 170& m7 f0 ]* g' Y' u) F( \" b
" t2 S1 w- x: C: A( Z" J6 ?
! No LABEL defined, using RIBBON_LABEL defined in customer_men.men
4 I9 V+ @9 y# T/ W ^1 uBUTTON CUSTOMER_BUTTON_1
5 ^6 ~& a1 ~$ b& h! t% uRIBBON_STYLE LARGE_IMAGE
; J+ V7 S9 \; P2 W9 U
# m1 }/ }* b5 M6 p- B( y/ {1 [( q! Example of a gallery defined in a GRB file.
$ a3 U4 W/ x; R, {: N! 3 g- j2 b Q) G
! If this gallery is to be used in other places, then it could be
q, ~; x1 j; s. G) P! defined in its own gallery (GLY) file and referenced here/ e* V, U3 X0 z% ]
! Example:6 U4 m. {- X+ L7 G& }# S. V
! GALLERY customer_gallery.gly7 X5 @) E% V+ e+ _3 U
!
4 _' K: [# M6 J6 r* I+ u0 {! dBEGIN_GALLERY CUSTOMER_GALLERY: m# @( e% O5 Y
COLUMN_IN_RIBBON 2, |! O* G' ~5 F/ V% I
COLUMN_IN_POPUP 2. P" N' C: ]6 a7 |1 u3 A' s
LABEL Gallery
5 f3 b( G6 f( {% N) ^6 _GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
0 J+ R0 r4 ?: G" h1 R1 ]* {
% T* ^; {& T$ [( X8 U BUTTON CUSTOMER_BUTTON_2- Q0 W Q# q2 L2 k$ N! K/ X) f
3 i$ w$ p. K7 R, { BUTTON CUSTOMER_BUTTON_39 e' [. w. `( a& I+ o
, i7 ~5 X7 A4 z! r BUTTON CUSTOMER_BUTTON_4
0 @; Q& t3 g: J& |" O' f3 u' r" D! H/ h# P' F* F. T# R9 M
BUTTON CUSTOMER_BUTTON_5
# G1 Y- n' a8 o
# \3 U) b" N' _( B' r9 QEND_GALLERY/ [, i4 ?0 N0 {) B& _
3 K$ Q7 R6 \. y ]6 z! V# E
, s3 ?9 I1 l! h! R( j) K
|
|