|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
0 w) A# U X1 j7 ]
经典界面到RIbbon界面转换
9 V0 I: V# p3 e: [* ~5 I6 s; U
在经典界面下,需要的文件
. ]7 `6 }- @1 m& T+ G- customer_men.men
- customer_toolbar.tbr
7 Y+ {& }. _) o T- N: M 在ribbon界面下你可能需要的文件
6 e! @4 q/ u: s2 j, ~# z" c. S% S# g6 L& G8 L9 F$ f% C+ F7 ~* t- P
# ]) m$ b6 p/ ?9 e1 n
举例如下:
+ Y- Y: I2 D' S Z$ U3 c' v4 z2 r* [
, J: i1 F k1 b8 g% `customer_men.men# l; Y) }3 j; q% g% H! c* Q
!
5 r% Y& _3 ?3 Y- U# E! Customer menu file) L* L0 j' l! p }
! + d# {/ ]' A( e/ s3 r( O l
! Contains button definitions to be used in ! N3 k% L% v; K, ^: q% a
! toolbars and Ribbon files
1 }! ?5 e% l$ K5 H- S+ m!
% R- c8 z+ R0 p0 x, F" H- W' a/ t' R# l
VERSION 120 \ w. X9 T; H3 I) e
: E: }+ p0 F# y. L, YEDIT UG_GATEWAY_MAIN_MENUBAR2 L4 k7 f4 o+ E* n+ H
" u- E5 e% o0 R2 g. E) S
TOP_MENU
5 v7 K. I) \3 r8 C; y- } CASCADE_BUTTON CUSTOMER_MENU
% X" u( A0 h% I3 G! h" c' _ LABEL Customer Menu$ F2 x/ t/ r5 c5 m7 a) u: J* _3 w
: p* @0 ]4 g5 Z9 u6 D
END_OF_TOP_MENU
+ l) w+ U& n9 S! H2 W9 ?- y9 e+ r( h/ j4 x6 }, H) a
MENU CUSTOMER_MENU
; z) \/ K* X( ]/ D- `. \9 d: e2 E6 V
BUTTON CUSTOMER_BUTTON_1
0 V( g# K( j S* q: _* s LABEL Menu Button1- D$ m/ y B! x8 q( f
RIBBON_LABEL Ribbon Button1
, e. U7 f- u9 U8 m1 I9 {# m- R TOOLBAR_LABEL Toolbar Button1
( F* {+ i7 |+ M4 M5 F o BITMAP fileopen+ A: \, J7 n% z+ k. X, i7 h1 r& W9 g
, }; p6 L/ s3 c; z: @6 E- G BUTTON CUSTOMER_BUTTON_28 p$ E! k$ u- _- C! }* [5 L
LABEL Menu Button2
* d$ H& r( p4 b% d9 S& `$ p RIBBON_LABEL Ribbon Button2
1 X) P: S! N4 b- @, \! Q4 S; V! m TOOLBAR_LABEL Toolbar Button2
8 m- L4 a" M4 ` |' l BITMAP filesave/ q/ O% a0 b7 `. z/ P
# w. h" c) N$ p/ v$ ]4 x0 i. `3 R BUTTON CUSTOMER_BUTTON_31 q1 P3 j. G$ O8 k3 M7 \
LABEL Menu Button36 D7 I; C8 } v1 M% _3 Y9 f n
RIBBON_LABEL Ribbon Button3' j9 `# t- P" r3 u
TOOLBAR_LABEL Toolbar Button3
8 Y- E& o5 }+ ~/ n# H BITMAP current_feature& o2 @7 d8 ~: b! v3 g
5 p( y! C7 z% T- D
BUTTON CUSTOMER_BUTTON_4/ Q" _0 [! t! d; L# t& B
LABEL Menu Button4* w9 h7 }6 i* g( [$ U6 _
RIBBON_LABEL Ribbon Button40 S, l1 C0 q+ P! h
TOOLBAR_LABEL Toolbar Button4
. `) L) f1 [9 r8 @ k BITMAP block
7 q6 {8 k% [# n3 @- R7 f R
" i5 u4 d+ u/ b) e* w3 S, T1 f BUTTON CUSTOMER_BUTTON_5
3 v1 S/ y, [3 h3 y. V LABEL Menu Button5
/ p; i. S# R5 B: X RIBBON_LABEL Ribbon Button5
! p/ X! Q- V. Z: ] TOOLBAR_LABEL Toolbar Button5
. Y- b3 V, m( a3 I3 L: D BITMAP checkgreen5 x; L6 K7 R* w3 ? a: f) }: H+ }% E
9 g2 X* p3 s/ ^8 G9 u; sEND_OF_MENU: T( T- B6 h: ^
: @) a- d7 f" L. O, J; S/ C, I" s0 q7 f; \
% U, U* C: N- r( ]& Icustomer_ribbon_tab.rtb0 c$ t" K& X. X9 g% b
!, x, z- O: [5 l& b
! Customer Ribbon Tab
' M5 W% m3 e3 \+ ~, n3 H!
& e( S$ {9 Z1 F! t9 _# Q! This file will create a new customer tab containing three groups and
9 X& u+ @+ n8 n: ^( K6 o' ~! one top level button.3 o- b( C! @# ~+ |3 h5 w1 N) L. r0 W8 P
!. t; ?; X' o' R- @: Q0 ?
2 \" Y, q, o, E: f( b% @
TITLE Customer Tab1 h n$ Y0 H/ q/ v$ q$ e
VERSION 170
7 K) ?5 m3 E7 t* ]" R% A; g
: r' K5 |% T1 Q4 T. r) H! The first group represents a Ribbon group that references an existing - U. e+ _# t- L# h3 I8 D: ~
! toolbar with no Ribbon style changes. $ }+ ~7 }4 h/ }* S! g! t1 F
!
* M( }/ W* k+ X- {! This is the quickest way to add existing toolbar content into Ribbon mode.# G# Q' |# J0 ` T, v
!1 G; Y; a. W/ o E
GROUP customer_toolbar.tbr
* c' w" U5 N8 _. d
! r0 v4 ?/ j" c" Z! The second group represents a Ribbon group that references an existing
; t+ r& _5 [( k$ n. l: a# T! toolbar with Ribbon specific style changes added to it. There is no difference( n/ D" j" B2 |# b S6 L, X h
! in how this toolbar is referenced in the .rtb file compared to the first
5 A9 l0 a, { f& C, F! toolbar as a group. The only differences from the first group exist within
8 n) j4 x8 u$ R B7 }! the .tbr file itself.3 ^, f9 O8 c7 Y
!3 O8 N' S3 L; {7 g" {* |
! This approach has advantages for customers that will deploy both Ribbon and
- D" l' f; e0 V$ @! Classic Mode customizations since all the content is defined in the .tbr - t! N$ M2 O, e V4 l
! file and it will stay synchronized in both modes. Only one set of customizations
: C' w0 ], e2 a* g. S! j8 d$ x! will need to be maintained while still making use of RIBBON_STYLE to # O0 L* O# |8 @& t
! control the presentation of the buttons on the Ribbon.& ^! F/ E: O+ `5 C1 \
!. ?+ b- o3 h- U
GROUP customer_toolbar_alternate.tbr
7 Q+ e+ E) y6 ]# X' `# |1 C* }. Q
! The third group represents a Ribbon group that has been created explicitly
6 {) [: h# @3 F; R- u0 E. D! as a Ribbon group and will not exist in Classic Toolbar mode. This is the
7 m' l2 ]$ F2 U7 o7 `+ G! preferred option since the user will be able to take advantage of all the # @0 l' L# X6 ~0 a0 J4 x9 M" t' e
! layout styles and containers offered by the Ribbon. : M! {" d [, p) y* i/ ]
!: i5 N' v7 l9 Z) ~
! For customers that will deploy both Ribbon and Classic Mode customizations,
" R! T- @2 E; @0 N( s9 H! this approach will result in no synchronization and two sets of customizations
! W, Y0 v: Z) R- g8 R4 M a3 q( m! will need to be maintained.! V$ I( V8 } v; ^% U% O
!
* g( O& n- b- r( E) j" F6 F7 ^! A group can alternatively be defined directly inside the .rtb file by using the+ ]; F! \$ ~& s: m
! keywords BEGIN_GROUP and END_GROUP. ; ]2 r# Q* Q3 Q7 ?& o8 f
!$ Y% o8 ]" U# F7 ~5 c
GROUP customer_group.grb
! q( D6 e* V- H1 h
2 _, b) N( r7 @$ {5 Y+ _! Example of a button that is placed directly on the Ribbon without being
1 A+ U7 r" f1 P! }+ l* i K! contained in a group. This is a simple way to add a button to a tab
" H- @6 `6 ?7 Q9 _! but is not recommended for many buttons since groups have advantages.! t1 z( P+ I4 e7 _( J# Q" n
!
# [( a0 n; a2 `; V6 U! A few advantages of groups:% L. I* ?4 E" z
! 1. Easier to move many buttons around together in quick customization.
; ~. e0 O6 C# W Q+ P" c8 S0 Q! For example, MB3 on a group and choose "Add to Left Border Bar". 3 Q( d( _8 N0 z. b2 r
! This will move the whole group to a new location. If buttons are / B" D0 J- A/ ~! p/ F9 I
! not in a group, they need to be moved one at a time.3 S8 i& i3 a, ^, L- d, i& F( A
!
6 B3 X. q |. s0 ]! q! 2. Provide a label to describe its contents.
3 @1 B. ^- x% ]" l' B4 K6 Q4 F) s!# y0 E# e9 }; y0 ^. C. S% u
BUTTON CUSTOMER_BUTTON_1$ z( B) Y2 z. y B/ C) B
LABEL Button1 Directly on Tab
, n, h) u, T2 Q9 Z: k" K
7 q& H2 g% d4 B* l' ^% ?' {
( o) R X7 a1 L5 g$ r' Z7 o0 C$ i1 v: Y8 [6 h
customer_toolbar.tbr
: l! g* e4 h: ^% |3 d2 B" Z!
/ n4 H, N+ K0 \, m! Customer Toolbar File3 Q/ X3 c) S$ n
!
1 Z/ V9 k( |: Q5 v& ~) N7 `# H9 o! This is similar to an existing toolbar file containing
% \& \+ v3 }$ T! no Ribbon changes.
/ y; R! o, a, q4 E M w!
7 a# V, n) \' o2 V5 Y' @2 f& h! In Classic Toolbars mode - This toolbar will still show up in the % s4 t1 x2 ?6 G" v5 ~5 j& I
! toolbars list.; h) N' i# V' {1 s1 T. M f
!
+ U! }6 ~, P1 W6 F4 P8 Y! In Ribbon mode - This toolbar will be automatically converted to a
4 M- s7 f" b( u i/ b n! Ribbon group and will appear in the "Classic Toolbars as Groups"5 P8 y6 h$ Q2 v5 n- N/ ?- R: w" t% a
! section in the Customize dialog.
% C, Y5 M2 | s% y5 Z; A0 e4 {! & H6 g, P2 g g& Y. Y
6 ^ `, p3 l) r: V: `( j" n
TITLE Toolbar& {1 s; D2 \, @2 N5 k0 I# t
VERSION 170! D# K V, F1 o% W7 z& H' h
+ U& a) B# E& V; D$ b0 Y! sBUTTON CUSTOMER_BUTTON_1! m5 o y8 z) Q
1 x; M7 q* y: h5 O
BUTTON CUSTOMER_BUTTON_2
+ S8 C" o; K: f4 n
7 t# l- p5 f# l f7 s) s* VBUTTON CUSTOMER_BUTTON_3
" u/ K8 s5 Y. X& }0 m3 Z
# V9 l7 o- C# o6 Q* K% e4 u0 {BUTTON CUSTOMER_BUTTON_4
1 v5 m" `' {( f& K' A6 j, y# L. |4 c4 i @3 k4 m1 { y6 N R1 a! K4 f' S
BUTTON CUSTOMER_BUTTON_51 F0 }! X- D* `2 f5 Q
4 h' ?, d' r2 B; A0 F7 s: |
$ v& [2 R! O1 P0 ?/ `1 c$ y( c0 W# F. _
% j1 `0 l2 o' U: N% k- T9 B3 `
customer_toolbar_alternate.tbr6 s D/ F+ D6 j
!
1 z# a2 ]. q5 m7 H6 \5 b1 U1 O! Customer Toolbar File (Alternate)
( Q& D, _. c6 `! k: b( F' S u9 M!* ^% e9 Y) d& j: m8 d; i
! This is similar to an existing toolbar file with new
, j/ W" u- C, x d' G5 F! Ribbon styles added.9 W, u3 I- @8 r5 e& P3 Y
!
2 M( s2 ^7 f# S% j8 R1 j! The RIBBON_STYLE will be honored when the toolbar is loaded
K2 |# d, V- E+ l! in Ribbon mode as a group but will be ignored when the toolbar
% N# E( n. i0 B# b7 ]# S* u! is displayed in Classic Toolbars mode.- a+ E# \- h7 T* G
!) w Y4 R" M4 b4 M) _% E4 Z5 C
! In Classic Toolbars mode - This toolbar will still show up in the , ^, G* ], ~2 `- p* `$ k
! toolbars list.0 t/ A' ] \$ Y4 i% S4 e8 t
!
0 J" r8 i; j+ d9 \6 a! A- @2 Y! In Ribbon mode - This toolbar will be automatically converted to a 1 n! K" f/ T, {
! Ribbon group and will appear in the "Classic Toolbars as Groups"
2 p" g! y w2 {4 u! section in the Customize dialog.: M2 b6 k, N p0 P6 I: v* H
!$ y3 o, m1 w+ i7 I& c6 I
; ?, b+ p2 _) d# ]2 w
TITLE Toolbar (Alternate)4 q4 T9 A+ w+ {# p' e" T) `
VERSION 170
( h: f+ |6 }( ]: Q1 y+ A, i+ f3 T7 S. B2 |/ M1 F0 H, @; W- _* o# b. ?0 n
BUTTON CUSTOMER_BUTTON_11 i( U [& I9 a: V1 v. C& m9 h0 y
LABEL Toolbar(Alt) Button13 y) d! z! V- A7 [: w
RIBBON_STYLE LARGE_IMAGE
1 S& Y& Q" v1 @8 K
8 |- q- b# Y# _; v% B& L5 iBUTTON CUSTOMER_BUTTON_2
9 o( n h g4 R7 |% p. t$ KLABEL Toolbar(Alt) Button24 k4 K% k8 W+ Q( C+ _% n: y
RIBBON_STYLE LARGE_IMAGE# ^) W7 C) G" V6 s) b9 y
% X# \$ i7 A4 |BUTTON CUSTOMER_BUTTON_3
0 Y1 z! d* f0 v/ v7 ALABEL Toolbar(Alt) Button3
1 L. W2 D/ z$ H3 C* ARIBBON_STYLE SMALL_IMAGE_AND_TEXT
; |2 x/ F; A2 o& L" V4 U
* {( F' {7 U% O. eBUTTON CUSTOMER_BUTTON_4
T$ K8 f# D; a* R9 X6 s' Y2 \LABEL Toolbar(Alt) Button4
4 Y) {- `6 m$ ^) u. ~: c4 CRIBBON_STYLE SMALL_IMAGE_AND_TEXT
5 S9 i; | d# F% k3 u$ b6 k! g4 [* }5 o- E8 x" G2 C9 r
BUTTON CUSTOMER_BUTTON_5
( B/ \- z( ?( D/ n6 wLABEL Toolbar(Alt) Button57 \" B7 [7 ~- @. e/ G3 w, f! S
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
: ^6 U5 J+ A! L) m
3 ^9 w3 v( T6 s9 C+ U4 v6 U6 Q4 q0 K% m: J+ C
6 p9 X4 t2 h/ P+ @customer_group.grb+ X+ X. g$ r* j3 l* n' C
!0 {4 }) ?7 G9 i( y# A# o
! Customer Ribbon Group File G5 ?( E8 E7 k9 U
!8 g# A8 {% y; f* y9 e# y' W" M
! In Classic Toolbars mode - This group will be unavailable
- l/ I: Z; D& h6 G!- u. K. w a+ |- B. F8 c
! In Ribbon mode - This group will show up in the "All Groups" list
% s z( V% e9 f" H! in the Customize dialog.
; f8 {7 I t8 P; [+ z: ~!
! m6 ^3 ^$ i& L$ v4 b' z0 y4 n! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
- Y- [: K$ n$ y8 D$ s!
; r# q- a. {+ G/ e; U, T4 m5 r% _5 }: b
TITLE Group
( j8 M$ c; s0 U( c" N* \5 ]VERSION 170. y* W; H# a- d2 d) j x1 y
c! N" `0 z' Q7 e! No LABEL defined, using RIBBON_LABEL defined in customer_men.men8 Q/ z( V' z) J) I; }8 ]2 K, c# ]
BUTTON CUSTOMER_BUTTON_1/ D0 @0 u7 C) E0 z H+ a- j N
RIBBON_STYLE LARGE_IMAGE, L- Y" i1 V. U. v4 J
; f! e$ ~ m: ]* P
! Example of a gallery defined in a GRB file.
8 l6 V) ]- E3 o$ S A!
" N N/ R8 ]# u% K( w) U$ r! If this gallery is to be used in other places, then it could be 2 Y {$ V5 @3 {7 u' U, B
! defined in its own gallery (GLY) file and referenced here
, X+ I8 x* _8 ~1 h* v) t! Example:" m% E+ Y$ }0 N$ b
! GALLERY customer_gallery.gly; ^- p& \6 n/ }6 A9 x" c
!
: [( A6 X. m/ m0 T$ U) eBEGIN_GALLERY CUSTOMER_GALLERY
0 ?. _2 `6 A6 w+ \2 k9 XCOLUMN_IN_RIBBON 2
. C$ z: B, ]8 gCOLUMN_IN_POPUP 2
9 @0 s( N# Q( g7 q4 H, T, u+ J, WLABEL Gallery
4 d/ a$ [8 ~& u4 V0 P' Z; p, cGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
3 J) n9 {0 O6 e2 A; O1 \5 i. }; s) h- Z* T
BUTTON CUSTOMER_BUTTON_2
- D8 M3 g V- j1 c0 X8 k5 O6 L3 K* }6 a
BUTTON CUSTOMER_BUTTON_37 a/ @, D; L) E) s% Y+ s* v
6 f# W9 }" I) L: z" @7 N BUTTON CUSTOMER_BUTTON_4( s2 u, ~' f' \, m. B- l3 b9 P
/ g8 h0 `. q/ K2 U: } BUTTON CUSTOMER_BUTTON_5
]$ m5 w0 O* `. T0 t) b8 f% f+ [2 M" l4 b& c1 J
END_GALLERY
& A% d) z) |8 s+ `/ L
$ o8 q7 t; n$ Q$ E; P
: O/ a" n+ D- q! r' B( f |
|