|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧% S& D* y, c# n1 S, `) r n
经典界面到RIbbon界面转换
; A- v# R: Q: B5 \
在经典界面下,需要的文件
( @- Q# e6 A! Q$ f- customer_men.men
- customer_toolbar.tbr
& v5 c6 e9 g6 m2 S 在ribbon界面下你可能需要的文件
9 i& v5 i V* s% X5 |
1 E, S( \; W2 H( O4 w+ ]! U' d
/ e* c% _6 b1 k/ N ^0 |& i举例如下:
. c8 O. g3 D, M, ]' J
1 h$ K% |) {. V. H$ T& e9 Q9 X, D" Q5 S' F( I+ ~
customer_men.men+ m# b# e/ |( i( N1 ?2 Z
!
/ }) w E0 ]: P# | y1 P/ F! Customer menu file/ ~* x, {0 a; F. o7 \
! + `; C3 q# j' t- r4 D9 N
! Contains button definitions to be used in . u' G% O9 ^ F+ j# J
! toolbars and Ribbon files7 {1 x" t% i9 _' d( E: h) X
!2 D" a% w7 c2 S: O) F
" E) Z/ A, V& X, N1 }VERSION 120+ h2 h/ P# `2 x- _+ Z# r
% ]) R8 P9 u$ \, p k$ k/ P- e
EDIT UG_GATEWAY_MAIN_MENUBAR
3 D- g$ u6 `. x) a; ^& f2 b5 M$ G" s( A: _; J; H6 ~6 p" s
TOP_MENU6 P5 p R8 y Q0 ?+ M
CASCADE_BUTTON CUSTOMER_MENU
' b# X% T1 t h; l o; r7 _: K @6 P LABEL Customer Menu
2 i' W7 g, J0 Q$ D+ J6 `
& B. _. @+ E( ?3 m! t$ R& ^& lEND_OF_TOP_MENU
% e7 V) |4 w5 R7 r Z8 m7 u* Z' l# C
MENU CUSTOMER_MENU
$ i* t5 P$ k5 f8 l/ p' y* F+ \8 N& r9 H! E/ H/ R
BUTTON CUSTOMER_BUTTON_1
5 z4 z9 u# l/ n' u$ r7 M s$ N7 |( { LABEL Menu Button1
/ g+ Q9 s5 C. m' E6 D; M RIBBON_LABEL Ribbon Button1
- N( Q) B1 |8 ^5 f5 t TOOLBAR_LABEL Toolbar Button1
3 ?, N; x2 n T. f BITMAP fileopen
; |% y- [0 w2 [5 e; R
; ?! o: P1 I9 S) s& Q; k4 u2 Z BUTTON CUSTOMER_BUTTON_2
7 b4 k; c N- d. K" X! n8 H LABEL Menu Button2* |8 Q' p5 h: y
RIBBON_LABEL Ribbon Button2: R: A4 o9 M& L
TOOLBAR_LABEL Toolbar Button2
# V# `% h2 d8 V7 X9 E BITMAP filesave
9 T2 \1 }0 u3 y/ A6 }$ i" w% u+ v1 ^; x+ H- }+ {0 S+ f! b+ k2 L
BUTTON CUSTOMER_BUTTON_3! ]: O8 }/ v$ |$ U% K3 F B
LABEL Menu Button3/ V# m- [7 f3 ~2 |. U; J, E, |- \8 I
RIBBON_LABEL Ribbon Button3
3 ]7 c% J8 K+ Y& w$ g3 f* s TOOLBAR_LABEL Toolbar Button3
+ o" Y; u6 O; |1 I) N, Y BITMAP current_feature
6 d. E' h& Y" A3 s
1 W" M" n+ p+ O, ]; \ BUTTON CUSTOMER_BUTTON_4
6 b7 ?; e3 l+ k! i( G( p! @ LABEL Menu Button42 y1 h$ z5 y5 A$ b- Y! q
RIBBON_LABEL Ribbon Button4, q* y" r/ v+ s" d
TOOLBAR_LABEL Toolbar Button4
7 U) S5 C) ~. i7 A8 r# g BITMAP block
% Y, O( i8 ~6 _0 G6 \
6 j& y9 G c8 c4 d0 _; @ BUTTON CUSTOMER_BUTTON_5! s1 s: U) G# ^5 v y6 E
LABEL Menu Button5
5 W4 r! l% [! i# d% N$ {; G RIBBON_LABEL Ribbon Button5$ b$ ?5 m) h; K& c" w" n
TOOLBAR_LABEL Toolbar Button5! @/ D5 [9 |) X- M/ O, E
BITMAP checkgreen
8 M6 C) { \1 N G# h7 I7 p8 X# ?% [7 V% O& A
END_OF_MENU& |/ k- }7 H2 h% _; ?3 y
- e$ G& o' g7 u0 m+ r
; a, A1 }* |/ z0 q6 ^$ g
7 F6 j& k8 D2 i6 N, wcustomer_ribbon_tab.rtb) l! O4 Q" J( c
!* F) U/ C6 U8 A, k
! Customer Ribbon Tab
) A( w) V# t2 k% j& {( f!
% h4 e6 C) {1 w! This file will create a new customer tab containing three groups and
2 p |8 L$ l/ I! one top level button. y, M+ r! s4 j' L4 g# U, O I
!) p4 ^% X' z t( e, H/ k& [$ n: n
8 \, \1 u7 [' U$ T' j
TITLE Customer Tab$ r# f3 A% L& s4 J2 _" k+ C
VERSION 170
% n& |) R9 N7 x( h6 ]
6 j/ g- N. o. X: v2 X2 N& N4 w! The first group represents a Ribbon group that references an existing
0 ?' }2 g4 a ?# K, |" v3 {! toolbar with no Ribbon style changes.
1 S3 s5 H. d4 [$ i% f! - |, U. g( s% e2 s1 m# M: {6 m
! This is the quickest way to add existing toolbar content into Ribbon mode. a- k. }" W. t1 S
!
4 c# E- ~ h) I, A. N6 b! x' _GROUP customer_toolbar.tbr
. ~* h, R& K% H; {/ R" ~
+ L* \0 ` i7 H# S+ Q! The second group represents a Ribbon group that references an existing . i( t. f* w: [
! toolbar with Ribbon specific style changes added to it. There is no difference
. K" m, Q4 k- K* _! in how this toolbar is referenced in the .rtb file compared to the first; v4 ]! i' b" T4 O
! toolbar as a group. The only differences from the first group exist within " J4 h) C% G6 i; Q) @$ Q
! the .tbr file itself.
7 s( h; [) |+ X9 h. |4 x!
/ j& H& D- h) i j/ \; W+ |! This approach has advantages for customers that will deploy both Ribbon and
+ B+ C+ r6 m9 a* z1 Y/ ?! Classic Mode customizations since all the content is defined in the .tbr
4 o8 w6 ^. N4 Z6 t t! file and it will stay synchronized in both modes. Only one set of customizations
7 y1 q! T( ]/ o- X9 u% f! will need to be maintained while still making use of RIBBON_STYLE to 4 r& v/ ? G8 I, i
! control the presentation of the buttons on the Ribbon.
8 k% S4 X: m. B; d Y" A7 \2 Q/ {5 P!/ d' d6 e8 A" g% M. C8 Q2 e1 q$ m
GROUP customer_toolbar_alternate.tbr
' L' B1 U/ P% `
8 i& \. W: m& |9 x5 T# k' |! The third group represents a Ribbon group that has been created explicitly+ O9 `" n2 t8 I" ]% _
! as a Ribbon group and will not exist in Classic Toolbar mode. This is the
$ _& l- @9 d/ S2 L) R& s! preferred option since the user will be able to take advantage of all the + t! L" S% o8 ?, `3 h# q, B
! layout styles and containers offered by the Ribbon. 9 v+ M$ D, Y7 Q- D. S
!- Q! a! {- f+ `6 S2 k9 @4 R
! For customers that will deploy both Ribbon and Classic Mode customizations, * d2 s2 b7 }& Y
! this approach will result in no synchronization and two sets of customizations
# M' [/ C) R- o* [4 I5 x L& x! will need to be maintained.
7 E' r0 W( r5 B% V( A! [!
! A1 W$ O* e( o I" [' r! A group can alternatively be defined directly inside the .rtb file by using the
2 Y) G; H% l3 \/ `/ m0 a4 ^9 \1 f! keywords BEGIN_GROUP and END_GROUP.
3 R" V& S! W; m! K/ E: S4 R!. R7 @' S5 n4 v
GROUP customer_group.grb
3 Y; e' N# |7 \. H) K( @: }: @& I8 ~2 K
! Example of a button that is placed directly on the Ribbon without being! p' G4 b$ a* ]
! contained in a group. This is a simple way to add a button to a tab- D1 a0 |- D! [. H. g
! but is not recommended for many buttons since groups have advantages.
3 `' T0 l3 w% f. K2 `& Z!
; N' p$ X6 `+ l6 k/ W, }& E! A few advantages of groups:6 u, ?$ h/ N8 C( g1 R4 k
! 1. Easier to move many buttons around together in quick customization. 0 o' x: J M# D4 O) [
! For example, MB3 on a group and choose "Add to Left Border Bar".
7 \, m& ]! N" {4 j3 o! This will move the whole group to a new location. If buttons are
) o: W& U! P( o8 |" J5 S! not in a group, they need to be moved one at a time.
) C3 }% r- ~8 o8 l/ D7 x!0 _0 ^; r" t: w$ F5 ~& x5 ^
! 2. Provide a label to describe its contents.& D8 h, e% X- n- s3 Y! D
!
; D. j ]; B) g7 @% M3 i% j5 eBUTTON CUSTOMER_BUTTON_1
- o1 o7 t/ }$ L1 _8 [LABEL Button1 Directly on Tab
) Q: E; q+ |! _9 K( k1 R0 t1 M! V \8 q `! N* } D0 t
. |8 N% L6 b0 j K' }8 p7 u. F
7 V( Y+ }$ D- e b# E3 m+ a1 Pcustomer_toolbar.tbr
: P" ~# D8 L6 F. s# J3 D, N/ p U!
, p) g0 u% G' i: H1 Y7 ^$ _/ |! Customer Toolbar File2 ?) }' p4 v2 s) f) }
!. u# J6 m7 [% f/ R
! This is similar to an existing toolbar file containing
. J, ~+ T g: B2 i! no Ribbon changes.2 w6 R! J3 ]+ G% }6 R4 L
!% _, L& i a6 m" I/ q
! In Classic Toolbars mode - This toolbar will still show up in the , [- k6 y6 g3 f$ H/ }( \& k- n
! toolbars list.
& V5 r% J/ ^) j) D7 }8 |; H. R" A!
: o: \& u# f, l' J- {6 `6 o3 Z! In Ribbon mode - This toolbar will be automatically converted to a
- J" S: _# S5 n O! Ribbon group and will appear in the "Classic Toolbars as Groups"3 A# `+ J8 P7 k: Y
! section in the Customize dialog./ t5 W' `5 ~3 `3 ?" N- R1 y6 l
! / J9 ?& g! ?( U& L0 p2 d+ Z3 A4 F
9 m1 A9 Q8 H Z$ X) _' NTITLE Toolbar- f1 l9 _, t- |) O; N1 l1 |6 \
VERSION 170
& ^+ ?0 d3 V9 n; e7 x+ W8 X C' ]: ?8 r4 f
BUTTON CUSTOMER_BUTTON_10 L( {" |- I5 y' g, L1 j
4 p* ~% `6 h/ w& o' c- b
BUTTON CUSTOMER_BUTTON_2/ _! \% m- Z! g1 t$ @
* x D( R1 H3 P: F% H! N) `
BUTTON CUSTOMER_BUTTON_3' T8 @7 ~( B$ q$ E$ p: \4 t
^( c8 W+ [$ j0 l, [, @3 ?1 aBUTTON CUSTOMER_BUTTON_41 P \* k7 x2 l- h0 S
, a: x* u$ g* }% Z7 e rBUTTON CUSTOMER_BUTTON_5
! }, `8 C: B, R" U; K. C, o/ j! E& W' P. l
. Z) x- K6 r2 D) d& N: E4 ?5 a5 S2 K
customer_toolbar_alternate.tbr3 c3 ]/ i, w" \- @
!
6 I) D8 z: r# }. |9 {: A! Customer Toolbar File (Alternate)! ^* T" e& f$ l
!% u9 s" o, I7 Q* E9 j
! This is similar to an existing toolbar file with new( Y8 U1 ^0 n* b3 E
! Ribbon styles added.2 k/ P* A- F. |! P& A- J5 O
!
% X3 X4 \8 O# Z V. m! The RIBBON_STYLE will be honored when the toolbar is loaded ! @9 X9 b; {" y; i8 h1 l0 ^* @
! in Ribbon mode as a group but will be ignored when the toolbar / E( i- \( Q2 `6 d
! is displayed in Classic Toolbars mode.2 L! @6 o% _9 }! ~; ]
!" w/ f1 s @8 I! Y d
! In Classic Toolbars mode - This toolbar will still show up in the
/ z4 d; c7 ^$ T: G: h+ b {/ j! toolbars list.+ R4 `4 ?& l9 F; O
!
& o; a3 Q( ^8 \" o f' |! In Ribbon mode - This toolbar will be automatically converted to a & m [9 P6 { g- {% V
! Ribbon group and will appear in the "Classic Toolbars as Groups"# K0 ~* l6 E4 a P! U( O" ^
! section in the Customize dialog.
3 M; W) Z/ O1 g1 L!
. i) v% B* m) `6 }& l9 s
6 U3 U( w# F0 I4 p e" T( xTITLE Toolbar (Alternate)
1 s. K" A/ ` q0 Y4 {+ \ v+ jVERSION 170
% J- X! s" k+ `, W- u
) @& i2 |2 e: y5 zBUTTON CUSTOMER_BUTTON_1
0 \4 k1 U" T9 ]" b1 A/ TLABEL Toolbar(Alt) Button1! L/ i, [! _9 `4 U3 |8 [) r
RIBBON_STYLE LARGE_IMAGE; F5 {5 ~% O* E+ w c5 q2 f
% Y$ V9 t5 T; S- w9 M
BUTTON CUSTOMER_BUTTON_2- E8 u, C) \/ L, G; B2 F. `2 A
LABEL Toolbar(Alt) Button2
- R/ {! H# `2 i2 x" t' k! G* [: ]% NRIBBON_STYLE LARGE_IMAGE
0 l( m4 u# P. ?7 a( U% f5 `% ]8 H1 d$ X5 R
BUTTON CUSTOMER_BUTTON_3
) a: f6 _8 k8 D) E: o4 W: uLABEL Toolbar(Alt) Button33 F7 Z' v* i* q( P; B
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
0 Y t& v- Y3 D5 c, K
# } x6 h. v8 B9 j, R3 l) uBUTTON CUSTOMER_BUTTON_4# ?, } L$ r! z/ N% [# H
LABEL Toolbar(Alt) Button4
# z8 [: t& p4 t6 R# S! oRIBBON_STYLE SMALL_IMAGE_AND_TEXT
- ?# l' W* W. T* C+ b2 i4 L; p" l; @( x% I1 g* z
BUTTON CUSTOMER_BUTTON_5
/ o- A+ x1 a% m) r% \LABEL Toolbar(Alt) Button5
^9 S3 ^/ K8 ?& d6 n3 KRIBBON_STYLE SMALL_IMAGE_AND_TEXT! [: E8 @ i1 `, R6 g
* _" |& _* [# p7 H2 W* ?$ G# X' V! I y
- @) N5 Y- {6 m5 ]$ g; {2 k$ q! Y! o* C! J. A; Z3 L
customer_group.grb! D# I) l8 f- k, Z; Q/ J; ~
!: s$ Q @( [0 X- {; j$ o
! Customer Ribbon Group File+ S2 I8 c; d9 [( o P0 G
!
1 q6 q. c9 V8 {! In Classic Toolbars mode - This group will be unavailable. X5 G1 ?* s. h6 b2 K% j
!
+ Y0 g4 t2 p4 y: u k! In Ribbon mode - This group will show up in the "All Groups" list y6 w$ s- ]' T! }( a5 |$ `
! in the Customize dialog." k9 ]9 ]0 b! F. x4 x0 g- A
!1 i& k T; M- t9 E. {7 v
! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
4 T& p o! c8 k4 l" R$ }8 u!4 L1 ~9 g! E/ s
2 H0 C1 ^# ~6 ?) A
TITLE Group/ A' G0 h) f- Z Z3 e, ?
VERSION 170
1 i" ~/ L, v+ Z8 A1 \$ ^
0 e; A! J3 u G2 c! No LABEL defined, using RIBBON_LABEL defined in customer_men.men
' b& \7 | A5 ^/ ]BUTTON CUSTOMER_BUTTON_1
$ g y. m- M1 t5 }3 l8 xRIBBON_STYLE LARGE_IMAGE
( {: \" c* C; w* ~
5 t" K" l& L! s9 X! Example of a gallery defined in a GRB file.
, Z+ m! b( o1 V+ |5 i! b/ Z0 Z!
; r. N( M! I9 K# O! L! If this gallery is to be used in other places, then it could be
3 f. E$ d. o! r! defined in its own gallery (GLY) file and referenced here6 p+ ]# A& Q* H! R7 N( H/ j6 S- T$ T
! Example:
/ V4 T' g9 \$ a) ~! GALLERY customer_gallery.gly4 D0 }, [; O }) R
!1 n7 t6 P# ~& }. j
BEGIN_GALLERY CUSTOMER_GALLERY
9 E* u5 A; j3 ^! {; A+ ]+ NCOLUMN_IN_RIBBON 2/ x9 P1 \! R7 d) T5 @( f) `' l0 {0 U5 p
COLUMN_IN_POPUP 2
! a( F5 b5 r8 N) ]LABEL Gallery% I' p) {+ _$ ^7 O$ s/ j
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT4 ?2 i8 f* z8 b7 | o3 R, Q
/ N9 D! R4 i, q; C" A% O BUTTON CUSTOMER_BUTTON_2! D! w% ]3 {# I" v
0 [0 o+ s3 h, s3 L q$ s" b BUTTON CUSTOMER_BUTTON_3
8 W1 A7 z4 z O5 ~/ D& y) {" f6 s s6 l# s2 T
BUTTON CUSTOMER_BUTTON_4
/ ?* O4 Y- D' B! W3 O9 W% s/ |% F0 y/ _! |4 `' [9 e8 `
BUTTON CUSTOMER_BUTTON_5% a1 m6 l2 T8 e0 f: G% q3 j* g
W" r' f1 \8 o' EEND_GALLERY1 f3 j1 k; Y& a" {) P: C9 L
9 h; x; b' C& r( }. z& P; M, N5 S+ G, I' O$ Y8 ^+ o6 x
|
|