|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧 E, z% X) s, B( D7 d2 t
经典界面到RIbbon界面转换
/ W. N+ ` Z1 Q
在经典界面下,需要的文件
9 ], k9 r M4 l/ u- customer_men.men
- customer_toolbar.tbr
6 A F# f" ^, A/ N' o/ c2 k 在ribbon界面下你可能需要的文件
7 K& L* x3 e! d: d/ J" J: a ]# H8 l4 e: e8 u; S- ]- S
7 T5 A: l) f$ \! i1 @- ~: Y
举例如下:
3 n3 y, W( D# S# O& J6 D; P7 u8 O! j3 e& |1 w) Z* W. R: @
) K' H0 O0 c9 G4 ^7 {) Q
customer_men.men7 C- O* o g* s1 b1 |: J
!
1 L/ ]8 b) z/ V. S9 [2 \- a6 m! Customer menu file/ g7 Y, {; y% n" h! z3 Z
! 9 i; {% V$ I& K4 N5 d* ~" @
! Contains button definitions to be used in
2 T8 V+ H- W! s! toolbars and Ribbon files
# Z( Y6 B2 B9 P4 ?!# N' a' q4 h$ a3 I% k. B
+ H p. S5 O% _' v5 \
VERSION 120$ _7 H% o5 Y0 Z# F: m
7 i M% ]+ v. \" p; aEDIT UG_GATEWAY_MAIN_MENUBAR0 y& T% ]0 a; L9 r. X, ^
# p1 @! R Q. V6 ]% c' aTOP_MENU6 n5 }% e0 i! ^8 `+ P! \
CASCADE_BUTTON CUSTOMER_MENU
w7 e D" I" x LABEL Customer Menu( n0 r% f6 d* F! {' H/ K$ O# G: g4 V3 [
?0 B9 x9 W$ f* n1 D: [
END_OF_TOP_MENU
7 q; R3 { H# F4 O1 B$ a3 s* `) F) M0 I8 Z# U
MENU CUSTOMER_MENU
' a3 G* T: a" G- K: h+ `# ?
8 Z- ~& b0 I" t9 T: t BUTTON CUSTOMER_BUTTON_10 d; }- q% \) A* j" S' T% O+ H
LABEL Menu Button19 ` a& {3 g; W0 X$ m$ Y
RIBBON_LABEL Ribbon Button1
5 T& N% z4 y: J7 w% ?) \ TOOLBAR_LABEL Toolbar Button1
$ p2 L. x1 i! Q4 K% Z BITMAP fileopen% [9 }* D& L: p
$ E/ A& L! l* `% s& {6 V BUTTON CUSTOMER_BUTTON_2
+ j. Q$ }! t0 y% X+ ?% g- W+ H LABEL Menu Button2% \% S3 L$ c1 Y6 T3 r5 y
RIBBON_LABEL Ribbon Button2" L& M- ?1 D! U5 d# W, ~
TOOLBAR_LABEL Toolbar Button2
& `# ]' F- |" }* V* O: F5 } BITMAP filesave
% ?" m7 l+ x' k$ a0 c) M
. j) |) A6 b3 N4 P BUTTON CUSTOMER_BUTTON_3
" \- x# Z- f% e/ a LABEL Menu Button3
) u( D0 Y3 S3 w9 P [! I: R RIBBON_LABEL Ribbon Button3* o4 ] K% h- q$ r5 G
TOOLBAR_LABEL Toolbar Button3- K7 T ^# g! u8 c7 H4 k, a. D8 B
BITMAP current_feature; U& V2 E: l# s% g- U0 C
4 G: m4 s0 j L/ x, L2 B1 d BUTTON CUSTOMER_BUTTON_4" Q1 J" D) D7 g* T, ^5 R
LABEL Menu Button4% [. T5 D* r B& V5 j: D$ ?
RIBBON_LABEL Ribbon Button4' y7 H. l& G% ~7 u
TOOLBAR_LABEL Toolbar Button4
3 e0 r& h. `' P1 C/ ]. C) m3 n. y$ r8 Y BITMAP block
1 M0 X" O0 B, @. O! Z q! A0 @/ U, o5 o
BUTTON CUSTOMER_BUTTON_5
+ S4 a& g# r9 X& o LABEL Menu Button5( W1 |% ?9 E8 b, H9 A* s
RIBBON_LABEL Ribbon Button5
/ u; K+ \' Z* u: z, }$ ? TOOLBAR_LABEL Toolbar Button5" Z7 J6 @/ A+ Y3 ?. }
BITMAP checkgreen
' e* I; v5 M7 `/ e
2 k3 b& N, m; E! k: x, h* JEND_OF_MENU# H- N, t1 E5 X
' m/ Q6 G" M8 m+ l5 U1 c6 f4 K! n& j5 v& a: p; l. C/ q4 D5 b
8 i6 C7 W. _0 s }# Xcustomer_ribbon_tab.rtb
4 M% A( v& T6 Q4 [' x% ]!- W7 N6 j* }9 h8 v
! Customer Ribbon Tab
( |- D; M; u" {! c! & d$ k+ v1 t& A+ @ X
! This file will create a new customer tab containing three groups and
( _5 l' e' f+ r: ?5 E! one top level button.$ c9 o$ d/ e. S" {5 e0 R
!4 m3 M+ _1 `7 Z2 J
# H* U7 U! G6 y, }' x: y: T& s. C- H- Z' g
TITLE Customer Tab
; N* Y( `0 O/ U* v) }+ B: E* Q: |VERSION 170
+ _2 b% v+ Z2 Q- l+ g0 B/ w4 Y; X) n
! The first group represents a Ribbon group that references an existing 1 M& d- y% z2 `. I( s- S- s- D
! toolbar with no Ribbon style changes.
: |& P: ]$ n1 e: j! 7 o; U7 c: o1 g
! This is the quickest way to add existing toolbar content into Ribbon mode.
K1 q3 h) M- k, ?: I# u!% A) | g- l, o" E; ?* G
GROUP customer_toolbar.tbr$ f9 d/ r; w! ], U: Z
- d. R2 o' L% K# ~8 a0 _1 o. p
! The second group represents a Ribbon group that references an existing
7 s3 \" M8 v+ _ n% @( x! toolbar with Ribbon specific style changes added to it. There is no difference3 A8 }9 o2 R) W. C% Y& ]) c& s. a, |
! in how this toolbar is referenced in the .rtb file compared to the first
0 J3 T3 T8 S) c" k. E* L3 R v! toolbar as a group. The only differences from the first group exist within + {* A! R0 J( c
! the .tbr file itself.' p! z9 W; K& G4 j
!
# J# C4 ]# L: k1 q3 R9 |! This approach has advantages for customers that will deploy both Ribbon and( p" W5 h, j4 I$ G
! Classic Mode customizations since all the content is defined in the .tbr 5 R& y" s, `. e2 @" v2 w4 T
! file and it will stay synchronized in both modes. Only one set of customizations. F k( W! J' {: S& Y
! will need to be maintained while still making use of RIBBON_STYLE to ! b2 x$ d8 g7 r5 {
! control the presentation of the buttons on the Ribbon.
m! v( T# `" E!
9 P- K+ M" t7 ~8 W8 N( M% KGROUP customer_toolbar_alternate.tbr
5 I: U4 M+ N0 q4 E! f. X
% R. i3 Y/ T1 ?# G) n, a! The third group represents a Ribbon group that has been created explicitly9 s) Z- `& ?- o
! as a Ribbon group and will not exist in Classic Toolbar mode. This is the
7 z! @5 u/ M; t% p3 t% q6 y! preferred option since the user will be able to take advantage of all the 8 d3 y, l! N& k& j+ I
! layout styles and containers offered by the Ribbon.
5 J# w9 `7 k1 t) W- l$ \/ `. @3 l% N0 V) Q!
( ]; N, L% a7 Y1 M* m; l! For customers that will deploy both Ribbon and Classic Mode customizations,
. A% [2 x; B3 {4 m! O6 ~! this approach will result in no synchronization and two sets of customizations
: v' g, W+ L* ~- d! will need to be maintained.. A0 j% L$ I* R+ K' L F& e
!2 Z& R6 k+ A9 k5 E$ Z. O% c
! A group can alternatively be defined directly inside the .rtb file by using the
5 z l8 k& Y3 @6 S3 J! keywords BEGIN_GROUP and END_GROUP. ) ]7 A& R2 j( K" S% Z
!
6 ?$ V- ]) r' B. _/ A( eGROUP customer_group.grb- r+ x1 {' N: L: L1 ^2 N G
3 T. {# [* Q, q1 j9 N
! Example of a button that is placed directly on the Ribbon without being
; K# F* N' s5 S0 s! contained in a group. This is a simple way to add a button to a tab
$ T( p$ A7 Q. a% r! l2 n/ f0 B! but is not recommended for many buttons since groups have advantages., n8 S9 @: x# Q- M) [
! 1 F: w6 ~2 }# k$ K; R8 T
! A few advantages of groups:/ G i) Y. Z j% E. ?/ j
! 1. Easier to move many buttons around together in quick customization. , _& E6 u! z. S. i$ J
! For example, MB3 on a group and choose "Add to Left Border Bar". ' `6 ], ~9 _9 {. d% v0 n/ g
! This will move the whole group to a new location. If buttons are
) @7 b1 T0 Z& G% Z! not in a group, they need to be moved one at a time.5 O$ O% [6 v% ^ N5 a6 a5 i
!
9 s. V Y' K/ n2 _% h! 2. Provide a label to describe its contents.
3 ~& ^8 j5 _9 v4 p!
2 ^7 l& D- B! Y) x8 F$ FBUTTON CUSTOMER_BUTTON_1
) J" ~6 G& d2 RLABEL Button1 Directly on Tab
5 d: t) a" E0 y3 D
! r1 F5 G! B/ K! E: o5 h$ X
; C! H1 X; l6 a' V
( P* l8 y( J) o: _* Acustomer_toolbar.tbr
3 q2 A8 T! ?3 X# |1 p! V3 @!
$ _. N7 i4 P" Q2 T9 \# ]0 p- ]& z! Customer Toolbar File$ ~; g. G7 A% g; @! ~- X( k$ d
!
9 I/ j, k e. P' h! This is similar to an existing toolbar file containing1 f: e! l T' }' S+ |2 K* i
! no Ribbon changes.
& i) q- f- s& }: T0 }4 K!
( o5 B* M$ j/ J0 a- v4 b3 l. R' d9 ]! In Classic Toolbars mode - This toolbar will still show up in the
$ G$ ~0 @2 M( U2 h! toolbars list.
0 l3 U" d( A. y( U1 D& K7 \!
5 ]( a5 {- ]. r' h! In Ribbon mode - This toolbar will be automatically converted to a ! K, a( |) [$ R/ ?2 O
! Ribbon group and will appear in the "Classic Toolbars as Groups"1 W- D, s1 M* S7 ^6 m
! section in the Customize dialog.
5 I h2 {) P: R/ H/ G! ; F6 i) C; w: Z; K# u2 `
8 O" m5 p9 i7 R7 E- d
TITLE Toolbar0 S# r* n k; k& B$ r
VERSION 170
0 z7 e) A: G+ }
- R; I4 X& O3 pBUTTON CUSTOMER_BUTTON_1& T% o7 v% \9 L: f h+ E$ B$ `
& U; \6 B$ f3 {6 r
BUTTON CUSTOMER_BUTTON_2
9 p1 n. X: A& {) Q+ l1 V7 s! p7 ^
5 G$ Q# }2 ]0 C# X1 |BUTTON CUSTOMER_BUTTON_35 x. M- L0 | S3 A7 M% Q
, {) v" c; i! k- lBUTTON CUSTOMER_BUTTON_4% V* l+ X7 z" N+ x
% ~- y U9 Y& D2 aBUTTON CUSTOMER_BUTTON_54 x* G) q1 O9 t* y k9 C* p& x% H
/ a5 V. i5 w4 z2 y v
. k( q+ N* l2 M7 G
/ n7 D; F& m2 z2 b0 D6 p$ k4 P8 [customer_toolbar_alternate.tbr
- z; h1 }* z6 k" A" ]% X# S!9 M9 ~ V3 P0 C3 i& j: [- V
! Customer Toolbar File (Alternate)4 x2 g1 o- \2 G+ a5 _. C
!
% M+ w: C F( f% s# Y6 x! This is similar to an existing toolbar file with new; {3 Y9 G( j4 r& T' x
! Ribbon styles added. R6 S& K9 F! j- N( y2 J! M
! 0 k! s- I7 k0 d7 l. C. ^
! The RIBBON_STYLE will be honored when the toolbar is loaded
: H7 c. a8 i- W0 a4 {! in Ribbon mode as a group but will be ignored when the toolbar ; X3 I2 A9 ~8 F; n/ P. @7 N/ Q
! is displayed in Classic Toolbars mode.
( s% u; |( K8 N' W5 v2 x!
! m$ y1 F# o- m( d, s6 Q! In Classic Toolbars mode - This toolbar will still show up in the
0 S& L) w% _, Y9 A, y4 w- ?! toolbars list.4 p1 ], a3 ^+ r! Y5 `, B7 G
!& O/ S4 D0 Z- |3 q, ~
! In Ribbon mode - This toolbar will be automatically converted to a
8 o* |, g. O; \# l- v) _! Ribbon group and will appear in the "Classic Toolbars as Groups", C! H% B1 J6 W
! section in the Customize dialog.
: c- x& g9 N% J! C$ l! A!; l! v, E. I" a. v6 _
- y* B% W( Q0 e* m! s
TITLE Toolbar (Alternate)
* O4 q7 M: V% d$ iVERSION 170
( v+ r2 b8 \' b
; o2 ^! J' X! F( W8 `, ABUTTON CUSTOMER_BUTTON_1& S6 u8 L; d" k' w7 V
LABEL Toolbar(Alt) Button1
9 l4 {( i. Z; S7 J! \$ P1 IRIBBON_STYLE LARGE_IMAGE
6 N$ Q6 G5 s2 Y9 I
# A+ k3 }- o; J0 RBUTTON CUSTOMER_BUTTON_2
6 S# P7 I; g# a. m- Z3 Z' ILABEL Toolbar(Alt) Button2
0 _0 V3 t* t/ \. p; aRIBBON_STYLE LARGE_IMAGE
+ m. ^) j- x' t0 I
4 p* K& ~7 g. m' s6 QBUTTON CUSTOMER_BUTTON_3! `' P" e) \8 M
LABEL Toolbar(Alt) Button3
5 P- h5 \. P+ Q! tRIBBON_STYLE SMALL_IMAGE_AND_TEXT/ }* m, ^; }* H2 _: \
" }8 [& E% ^/ g3 F, A) Y# s
BUTTON CUSTOMER_BUTTON_4
( B, @1 u4 Y, [- @7 C# I, ~: Y# CLABEL Toolbar(Alt) Button4
" [ l: o2 h, S6 @7 Y7 hRIBBON_STYLE SMALL_IMAGE_AND_TEXT, i9 W0 ^# G. Z" O+ Z" L( O( b
. n( L, R9 Y, f
BUTTON CUSTOMER_BUTTON_5
' C( K4 z5 i: Z9 ~5 aLABEL Toolbar(Alt) Button5
, S+ v2 D% [- `7 a5 XRIBBON_STYLE SMALL_IMAGE_AND_TEXT; v- ^# V( u8 D* |7 Z. [1 u. y5 ^
3 @) ]* \2 f: S2 ^# m
- `6 e$ w+ t; t5 v* N& t, a/ d6 j d4 s
customer_group.grb/ {5 I9 e1 Q5 q2 k
!) ~7 K9 q& h8 l, d2 ^
! Customer Ribbon Group File
" |) q# E! i: |$ u!" I0 k1 ?# O4 V0 s8 s: L
! In Classic Toolbars mode - This group will be unavailable
; {- }% ~# A/ c9 g!: S( |" u5 U: P0 q5 S3 N7 E
! In Ribbon mode - This group will show up in the "All Groups" list) K4 }8 t; ^1 m4 H. G) G
! in the Customize dialog.- A/ E& T1 u+ T% k1 P1 ]$ _$ a1 {
!
- Z4 b! u) u2 b( n% U! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
0 G: }2 U5 M( A, \5 o. U' V!
0 o; ~8 N5 A( `+ e' R+ Y' ~/ ]* @) p8 v
TITLE Group' r8 T0 B" E' I
VERSION 170
& y: B Q/ o7 X; U7 {3 ?$ o' ^% B; T- u
! No LABEL defined, using RIBBON_LABEL defined in customer_men.men
; u3 g; u% |5 T: j) KBUTTON CUSTOMER_BUTTON_1
) k% j0 u7 U5 K( m$ S* pRIBBON_STYLE LARGE_IMAGE" x' T1 e* V5 F: A9 Q- j
, v5 k8 H3 ]+ w# T$ V% D& y0 m% t! Example of a gallery defined in a GRB file.
' A; A( X4 n) u, |. x!
8 c7 Q7 v8 L+ O. W! If this gallery is to be used in other places, then it could be
1 a& q" f1 f2 R- ?. }! defined in its own gallery (GLY) file and referenced here3 e% Y$ q- M9 g: z
! Example:2 P c7 | H& R( x9 m2 x
! GALLERY customer_gallery.gly! |) B" @6 e) Y0 h( h; b3 \# c
!
# e* G: n$ Y+ ?" \0 z1 q0 SBEGIN_GALLERY CUSTOMER_GALLERY3 c, l$ U* Z( V8 Y/ ?
COLUMN_IN_RIBBON 2" \( {" j6 r( W" `! n1 J; T1 U; F
COLUMN_IN_POPUP 2' W' f! k* e9 r. ]
LABEL Gallery8 M$ g: A" [4 l$ ]
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT! \ k$ r4 a& R0 |/ I
$ _, y7 Y. V' `, u3 H, {, v
BUTTON CUSTOMER_BUTTON_29 T+ O! \5 P. N1 n! K S: m! o
; A% k- o/ f1 ]
BUTTON CUSTOMER_BUTTON_3
* o6 W+ P0 n" `5 E8 F/ c
! N% p6 U* u: w; i0 e* s BUTTON CUSTOMER_BUTTON_4( W& k) a0 q% P6 g2 g1 {, q1 M
0 f( O! ~1 O* ^ O9 x, _ BUTTON CUSTOMER_BUTTON_55 D& q. ?4 K# b/ F) U1 a+ n
6 s" z i% k0 z- b5 R3 |' JEND_GALLERY8 e( r% k( Y5 a' z( \
: M" k2 a$ a: T S6 q; M' J% r$ B. ?
|
|