|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
) K, L- [; f& O$ Z
经典界面到RIbbon界面转换
" B& {) r J* t( P/ J& k0 D5 g
在经典界面下,需要的文件
& |. l8 m1 H2 O4 H- _% n1 E7 N- customer_men.men
- customer_toolbar.tbr! ?, i0 y: |& s: r; n! y! l6 J9 {
在ribbon界面下你可能需要的文件
1 Y' Z' t* P+ `
: L' R: Y2 M) H% r% {1 z) v* u/ c9 a& ?8 \0 z' o( ?
举例如下:* R6 ^- X& q4 m) \
$ G+ X7 B9 G- R+ f& E6 b, d
& A o* I* G$ L1 H m: d! lcustomer_men.men: l! U! f' Z/ A2 G/ D, J( X5 Q$ n# q
!8 @4 d. X3 d6 b, |' |3 E
! Customer menu file! \3 k( ]" s- ]; @9 o. X; d3 T: k
!
& N8 r+ Y: e! G. N! Contains button definitions to be used in . N$ W% M x' K* i! T3 C) x
! toolbars and Ribbon files
1 y7 t5 Z3 d4 m!8 [+ D9 a# X/ x6 o3 x
% V% l' h$ ~8 I+ b( R+ L
VERSION 120
3 L, l6 z+ _5 e0 ?2 ]& z) \# S9 }, A1 R6 v" e
EDIT UG_GATEWAY_MAIN_MENUBAR; A" J1 t7 I5 U; v3 c
/ V6 s" ~5 `9 z: Y' ]) O @; {- uTOP_MENU
5 R/ j" D9 X# D A CASCADE_BUTTON CUSTOMER_MENU& ~' }! j- f- \0 O" F/ F3 o
LABEL Customer Menu" h, e* f/ [% |! z% K
# n! a9 F$ G8 P- ?2 C6 t' {END_OF_TOP_MENU
7 m7 {5 P. ?: ]" o# |
! b, N9 T$ M; D5 b; r3 {MENU CUSTOMER_MENU
7 k& ^5 ?8 b g1 \! \! t
1 M1 ~1 x+ Q2 v3 d1 P3 m BUTTON CUSTOMER_BUTTON_19 q A) _7 I4 n
LABEL Menu Button1; c; s9 h- S. v8 U
RIBBON_LABEL Ribbon Button1
( @, b( h2 i( L$ w/ U+ r$ @ TOOLBAR_LABEL Toolbar Button1) l" K3 g' T* ^8 Z/ l
BITMAP fileopen
7 |2 p. L# i6 p4 q' ^/ T @' M# X# U5 ^0 z/ n
BUTTON CUSTOMER_BUTTON_2
, S' u+ A4 G' g/ `& X LABEL Menu Button2
( Q. X! g; R8 p0 @+ W RIBBON_LABEL Ribbon Button2% `/ e' Q1 ^0 Z( T
TOOLBAR_LABEL Toolbar Button2. |$ y+ `1 U0 S8 _7 ~7 j
BITMAP filesave
# O5 [% V+ ]8 Q8 R& m
% C! k7 `' m' `' v3 x2 X) H& L BUTTON CUSTOMER_BUTTON_34 ~5 |) V: N, }9 ?/ @* O
LABEL Menu Button3
9 g1 l; F- e; a& H! D! u RIBBON_LABEL Ribbon Button3. E- |; s: m2 u# m5 |& w, I) b, T
TOOLBAR_LABEL Toolbar Button32 P. k$ C& i8 {% @, F6 x
BITMAP current_feature
- f9 H9 }) q! S6 x) c6 @/ v) u: |4 l& I6 l: |7 I |+ s: k
BUTTON CUSTOMER_BUTTON_42 A" J8 J+ \: g/ |/ f2 E
LABEL Menu Button4/ x1 k, k3 f: i- V+ b6 L
RIBBON_LABEL Ribbon Button4
5 Z2 E' R/ o9 e% j+ r3 R. V TOOLBAR_LABEL Toolbar Button4
5 m# \' V2 @' F+ g- ?1 h9 O! E BITMAP block
0 e/ K# z( d8 K) W$ E2 D, R2 }2 O% U! R: V2 ^
BUTTON CUSTOMER_BUTTON_5( K" r9 @# r4 W) Y) u. g
LABEL Menu Button5; \2 Z) l" l$ g
RIBBON_LABEL Ribbon Button5
( @: r4 G5 c! t* r: G" e! s TOOLBAR_LABEL Toolbar Button5 Q( B; u2 d) o
BITMAP checkgreen! R; O0 b7 A) N6 S8 A
( C5 g. M) P8 \" d9 g
END_OF_MENU
4 W) h- ^1 p' x0 u7 k4 y
6 ^+ n5 s- D( h, i+ F" h" r
+ ]# u1 Q0 H# a
a/ T: W( B+ ocustomer_ribbon_tab.rtb
; p0 ]5 S# @4 I- F3 ?!
0 A1 j% u4 C4 z8 L- J! Customer Ribbon Tab6 b6 J) Y) ]+ H* P
!
: |" f/ X5 b; z! N7 b! This file will create a new customer tab containing three groups and4 i, y; c' \; f# f+ K1 B+ `
! one top level button.6 U! ^4 O) E) _6 _
!
- J+ `9 _- ^9 @+ s1 V& ^ ]; O! |" n
TITLE Customer Tab
, |; [' u! t, c7 G% z6 r2 `VERSION 170
4 o7 C. [- G' l. H; {2 e$ R# u" G a
! The first group represents a Ribbon group that references an existing ! N2 k) T) @) k [2 l
! toolbar with no Ribbon style changes.
" e( l$ p/ w9 s4 x$ {# l: ?! " Q, w( U$ h2 T- y" u3 z; ]
! This is the quickest way to add existing toolbar content into Ribbon mode.
( t, x! ?7 f8 _!
8 D: p" f8 T* n! GGROUP customer_toolbar.tbr
% o, x9 t5 d6 ]: X
* N1 t! M: t% J! The second group represents a Ribbon group that references an existing 1 M" L3 v" h: J
! toolbar with Ribbon specific style changes added to it. There is no difference/ j. R9 }4 ~0 _9 V& i
! in how this toolbar is referenced in the .rtb file compared to the first
' A0 p: J* {. P! R; C! toolbar as a group. The only differences from the first group exist within
' q- \( ?, c- I" g7 M! the .tbr file itself.
9 m$ v$ W2 i( W' b% e!
. _" x$ W" a6 Y( |( W! This approach has advantages for customers that will deploy both Ribbon and
; I; ^: X5 c3 X9 U+ H! Classic Mode customizations since all the content is defined in the .tbr
. Z( {2 J: J8 V; S4 U! file and it will stay synchronized in both modes. Only one set of customizations
/ }" p4 g9 N/ ]# A, o1 V' y! will need to be maintained while still making use of RIBBON_STYLE to " T" `$ U: {) ~
! control the presentation of the buttons on the Ribbon.
2 [- j: b: s' v: A) D$ H, n!$ d0 D/ T: u( R
GROUP customer_toolbar_alternate.tbr
) g3 i9 b) G: r- m8 q
2 l/ ^2 X" {9 s6 E% v! The third group represents a Ribbon group that has been created explicitly) n, U3 ^- j* c) B2 O
! as a Ribbon group and will not exist in Classic Toolbar mode. This is the, }9 b# T$ x) }
! preferred option since the user will be able to take advantage of all the 2 F# F* h! S E( Q5 e: y' w
! layout styles and containers offered by the Ribbon. 2 F% q1 @0 u1 l
!5 _# n# f/ ~: R( ?3 `0 W8 |
! For customers that will deploy both Ribbon and Classic Mode customizations,
1 w i6 S4 y8 u) @6 L3 k! this approach will result in no synchronization and two sets of customizations . s+ n! J0 e4 z1 y8 A
! will need to be maintained.! F9 q. Q b* L+ O4 i/ F' A" P% Q z6 D& f
!2 P t, J6 H% v8 V/ O: L
! A group can alternatively be defined directly inside the .rtb file by using the/ g( ^% v2 `. d- M: g5 h
! keywords BEGIN_GROUP and END_GROUP.
1 ?6 m8 T6 {! T: G7 k!) Z9 k( c. [& H% j& R
GROUP customer_group.grb2 \4 {6 Y) ?" _+ Y# A) s
% j) W0 |7 [8 m* X! Example of a button that is placed directly on the Ribbon without being$ a2 S. V v `3 a
! contained in a group. This is a simple way to add a button to a tab8 m$ s% x) N4 p0 C$ |' \' ^
! but is not recommended for many buttons since groups have advantages.
" D# L- m0 i1 b/ l2 J& z5 R/ }- G!
% m. _8 M$ [, o! q9 f! A few advantages of groups:
' f1 V1 M. S2 y; |& J" S! 1. Easier to move many buttons around together in quick customization. * W& G# ~/ a Y, o- C
! For example, MB3 on a group and choose "Add to Left Border Bar". 0 S2 @) ?6 X' G" A; f0 |
! This will move the whole group to a new location. If buttons are 9 T; o S: a b+ Y5 G6 F
! not in a group, they need to be moved one at a time.5 o9 I) T! z# ]( d& u! P
!3 b' X5 }# c* a4 O
! 2. Provide a label to describe its contents.
7 e( I! x* v6 A+ b% F+ I1 b7 X2 r!
) Y ~# C. m- v3 H0 \3 BBUTTON CUSTOMER_BUTTON_13 S4 C" U+ ?- J d+ a; T {
LABEL Button1 Directly on Tab- i+ h9 v' v4 _ Y/ H7 k" `
, W' @ q3 m* s$ l4 ^. s5 j+ X9 F
) _5 \4 \; }0 {9 ~& {
h) A/ x3 R% u! |8 A0 K' Dcustomer_toolbar.tbr) M0 x$ F$ H! {# s9 F
!" _. c5 Q* u2 u1 m' q; q, b
! Customer Toolbar File
) y" [ D$ Q4 w3 @. U!. \+ M+ W1 K( Q. C# W- B
! This is similar to an existing toolbar file containing/ L T" w5 E% u5 n, H& B4 k
! no Ribbon changes.
& \% I4 J. ~- h! R7 [9 ?! l% t0 ?! }5 l
! In Classic Toolbars mode - This toolbar will still show up in the + |& q: R) `, y" N! p
! toolbars list.# y3 @8 P0 g) b+ C
!
* N( M. s& ]' D' o! In Ribbon mode - This toolbar will be automatically converted to a ! {# j. P+ m5 T# {$ L0 F
! Ribbon group and will appear in the "Classic Toolbars as Groups"
& G# l9 ?: V1 O! Y. {! k- w- y! section in the Customize dialog.
* |1 `3 t+ f6 E!
, {4 y3 ?' C u1 \1 I; r- N, Q3 ]2 j" n" D
TITLE Toolbar
+ n. C; {2 \. D& ?, i0 H1 wVERSION 170
6 s: `7 C* s* ^, V0 C
7 ~7 s) r i. q( w6 dBUTTON CUSTOMER_BUTTON_1
# Q. E9 T7 x, k1 @% r$ ]1 Y
. E( F* r. Q. |BUTTON CUSTOMER_BUTTON_25 y" t/ [! J5 ^; Z' ]% f% V% A
9 ?: L6 ^8 }( A, O' L/ B5 W; K' W' [
BUTTON CUSTOMER_BUTTON_3
5 Y; m" k( M3 p) q; @/ l
H8 `, N; w7 a7 ?4 c* D+ q3 }* TBUTTON CUSTOMER_BUTTON_4
% }6 _/ @# {8 o4 H9 R
1 d) F) C5 D" q0 `BUTTON CUSTOMER_BUTTON_5
7 w0 \) d# E* H$ X6 K0 N, V* g, n$ P: s- Q' Q
- n' t; I* ]% e4 ?, W/ E$ u
( t/ i/ U+ H# R2 f; M. Ccustomer_toolbar_alternate.tbr
2 H( O9 b& n! z6 M- J9 h. o, n!" t" D/ ]& F) C. d
! Customer Toolbar File (Alternate)
( o/ Q; r" R* r% V!- a& T/ R n: S5 y! N& w# _
! This is similar to an existing toolbar file with new. W8 p( l/ P8 s" v# Z7 b7 c& P
! Ribbon styles added.! g& ]) D2 d- M7 P
!
6 L) |$ Y) y" F) t! The RIBBON_STYLE will be honored when the toolbar is loaded
* P1 r" K; c! r8 p- S0 P( S" N! in Ribbon mode as a group but will be ignored when the toolbar
# u5 V* w# g7 _$ V2 L1 Q! is displayed in Classic Toolbars mode.
3 D) q( u* Q/ k4 @/ M4 U!
; J& p. u, A7 A6 O! In Classic Toolbars mode - This toolbar will still show up in the
$ x# o! H( {. T0 a/ |! toolbars list.- S d* T! u) t
!5 _2 U/ p# Q# A* [+ ~
! In Ribbon mode - This toolbar will be automatically converted to a
; f8 {; u0 k/ h$ w1 \1 |+ T! Ribbon group and will appear in the "Classic Toolbars as Groups"( C" g9 T0 i& A. W- N; Y
! section in the Customize dialog.
/ z9 Z+ d( n1 ~ \( y!. @1 j" ~. j4 |. B. N Y4 g7 ~
3 K9 u# ]* A7 o; A
TITLE Toolbar (Alternate)# N7 Z$ z( H+ k% A6 e9 h
VERSION 170$ d4 D& g, Z$ P
x' g1 [1 _5 t' _+ H E
BUTTON CUSTOMER_BUTTON_1
* l8 ]7 y/ |. w0 a1 V4 \+ oLABEL Toolbar(Alt) Button1
4 [+ |. K0 T' jRIBBON_STYLE LARGE_IMAGE$ B# K2 x& U6 z4 G# k6 c# d
9 |) h0 `0 K! ]) B% A/ B& d/ i$ p
BUTTON CUSTOMER_BUTTON_2 P. o& |! q! E0 T3 ^. l( M
LABEL Toolbar(Alt) Button2" U+ |& W M/ v" z" h, x4 ]" c
RIBBON_STYLE LARGE_IMAGE% }0 A3 \; G2 I7 B( p+ n- I; q s" A
- V/ E6 ^5 W, \+ r) O) a/ @5 W7 EBUTTON CUSTOMER_BUTTON_3- C1 S$ B+ T/ E$ m) D. ~ W
LABEL Toolbar(Alt) Button3
! e$ }" B+ S% t% gRIBBON_STYLE SMALL_IMAGE_AND_TEXT1 h) \. M8 O% h4 Q& F" H
/ X( G) N1 x3 W; D6 |2 k
BUTTON CUSTOMER_BUTTON_4
1 l* b9 N& I9 k6 NLABEL Toolbar(Alt) Button4
( C3 `; u0 @7 m% D* \7 A' J, O# mRIBBON_STYLE SMALL_IMAGE_AND_TEXT, s; k+ w$ e6 S; T! ]
( N8 d5 {" e1 ~8 d, y9 cBUTTON CUSTOMER_BUTTON_5
3 _0 k# C9 b4 e$ r" ~% LLABEL Toolbar(Alt) Button5
- [8 h- `7 A$ hRIBBON_STYLE SMALL_IMAGE_AND_TEXT& k; s( G) Y# C
7 c, P# B$ ?; q9 N2 r! A( }4 A B9 {! q3 r
: A9 r2 ?6 }% E5 l/ j
customer_group.grb4 r: D, ]" I8 D( Q6 r1 h
!
6 q* G; H' ]: J4 G; b: O/ Q) W! Customer Ribbon Group File" r- a4 l6 c3 U1 R1 x+ t: D' w+ w
!
, e/ T2 P# T( H" m( A1 W1 e! In Classic Toolbars mode - This group will be unavailable2 Y1 i* b; Q! _. u$ E
!
8 M7 }# V* f. u! In Ribbon mode - This group will show up in the "All Groups" list
1 r* N! C. N0 E$ [9 B! in the Customize dialog.% I0 x) C5 L, ?
!
1 R" h) e8 Z3 M& c/ S j1 y; G* |! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
* E0 e/ n, h) |3 q5 N! t- a!0 C9 N" f2 N5 x( n, |, m) D
6 k$ B. O- V5 E8 s& nTITLE Group
4 d$ I' {' `& WVERSION 170# j* P; x+ [4 B9 |
; H& B; N; i( Y4 ^
! No LABEL defined, using RIBBON_LABEL defined in customer_men.men
7 ?$ |0 x: D( v9 G9 S2 k' TBUTTON CUSTOMER_BUTTON_11 A( U3 Z% f* r; |/ ^- ~
RIBBON_STYLE LARGE_IMAGE
I/ r' _# m& c& T! r+ N, h
9 [. R v' O; k8 x7 {" W! Example of a gallery defined in a GRB file.+ D* m& b; v T
! 3 i# ]8 s& G. g& N- r$ d% N
! If this gallery is to be used in other places, then it could be ! F; p3 H7 `4 D' z
! defined in its own gallery (GLY) file and referenced here X+ L2 i$ M* U8 D% f9 j
! Example:
# y p! h7 u, R. ^# M! GALLERY customer_gallery.gly1 N* v2 P. G( P* q6 {
!
: J' E7 ?4 f2 Z0 A: zBEGIN_GALLERY CUSTOMER_GALLERY
4 O% ~$ E& @) j1 x7 d& |COLUMN_IN_RIBBON 2
# O1 l/ P( s/ @( v) N: P- c2 ZCOLUMN_IN_POPUP 2
& s& \2 C* ^ A$ O- U7 oLABEL Gallery
! f3 w6 ^! E3 w# p* q% OGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT. O! ]* _! M1 f7 \% o9 A7 |, ~4 m
7 C% N$ a) u- i
BUTTON CUSTOMER_BUTTON_2" x9 F0 j( }5 b, q
# g% G2 H) j! `8 p# ~
BUTTON CUSTOMER_BUTTON_3
. x3 g6 Y+ H e: E( M2 ^' l7 f7 M6 t8 H# X, `
BUTTON CUSTOMER_BUTTON_4
0 R' I5 F& h0 Y$ p, [% g1 `' \+ M% j
BUTTON CUSTOMER_BUTTON_5
5 l8 b3 h1 |" t, I0 Z) d2 W
" G# q' F, r. i: V) dEND_GALLERY x" O" X8 j6 K% Y1 a; ^
% O$ i3 `3 U9 q. \5 _: y- O8 M, r2 n# U8 p. R: L3 p
|
|