|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧$ ]9 x* b; y6 t! X; C
经典界面到RIbbon界面转换
+ a5 O; t- ?0 {% j
在经典界面下,需要的文件
# Y$ g c3 G5 d0 M- customer_men.men
- customer_toolbar.tbr
) T, _/ n3 J2 A$ T 在ribbon界面下你可能需要的文件
8 j) Q T4 i8 w) O9 Z
7 d W9 Y$ Y. t* b2 U3 C" w
& f! [% E! r% k2 X2 ^8 N; p举例如下:. o( _3 z4 e1 s% P
) Z0 U5 d& O" n
% C$ n& U' y0 j5 {. T; i" zcustomer_men.men
* b" _$ q3 T) T+ H!- s; w4 q6 w6 T3 m
! Customer menu file
7 {. z. F7 V" d' s1 ?2 w!
8 ^" Z3 C% M' C9 o7 a/ E! Contains button definitions to be used in
9 r- g" U5 k- e0 Q' |+ B! toolbars and Ribbon files9 ?* y/ Z; ~# ?/ o2 K$ i' l
!$ m& v \6 Q3 D4 X. u, J/ o9 N6 Q
. D% i/ z6 d% Z1 z
VERSION 120
* c/ ]9 E" E0 n! ~4 z% I
8 q: c* o) c3 @! h( ^, DEDIT UG_GATEWAY_MAIN_MENUBAR
. z4 U0 b7 b3 E$ v/ W Y+ G
) ?, ]& I, }# b$ MTOP_MENU/ ]% P4 t% M& O: Z1 a6 `
CASCADE_BUTTON CUSTOMER_MENU& b; {, j0 O' ~! h+ G
LABEL Customer Menu, ^$ l8 V* c+ D9 B
/ m5 K* b) V. A' m$ w9 lEND_OF_TOP_MENU: a/ R% a5 _4 ?. g
# P; t& q8 Q4 s# I% p! J2 ]) CMENU CUSTOMER_MENU$ j3 ^. ~* d4 n* S6 y# o5 H
7 c9 ?; G0 h3 `/ }
BUTTON CUSTOMER_BUTTON_1
# ?8 Y7 i) w7 f' f: y$ \ n0 [ LABEL Menu Button1
' u9 l: [: B$ V ?/ m RIBBON_LABEL Ribbon Button1* t' G! W. p" j1 U* E9 R) V. J
TOOLBAR_LABEL Toolbar Button1: z" Y; K7 T* W5 l1 H3 j3 N
BITMAP fileopen5 t( i8 f& N0 p8 H0 Z; _1 w
- z) f# M3 i R$ w+ z& ~, g' k
BUTTON CUSTOMER_BUTTON_2; [7 \& o4 X) k# w% }! q A
LABEL Menu Button2
" J W/ w6 U7 q1 L* [# i, E; O0 l RIBBON_LABEL Ribbon Button2
& T9 D9 ~8 F3 ?0 H! F( c: | TOOLBAR_LABEL Toolbar Button2, C% H3 q0 r! K) E$ J# i& @
BITMAP filesave
! s) L6 Z% N! L2 }3 e1 c
. ^9 ^ M# P2 c4 J/ b; M [5 U BUTTON CUSTOMER_BUTTON_3
$ j9 M, Q7 n# h; ~5 B LABEL Menu Button3
. c' O- S4 W: K2 |8 C RIBBON_LABEL Ribbon Button3- o. c, e2 x3 C" Q! b
TOOLBAR_LABEL Toolbar Button3
8 A) L7 s& S5 r BITMAP current_feature
. E2 J4 m8 A' |* J5 ?8 l4 W
o q( l7 Z6 f! C7 _ BUTTON CUSTOMER_BUTTON_4: N. J2 Q4 |' N( C! d$ @
LABEL Menu Button47 U/ z! W9 W! D I
RIBBON_LABEL Ribbon Button4, y- p: T5 ^/ p! ]7 T
TOOLBAR_LABEL Toolbar Button4
/ Q" V& I4 x4 Z- i BITMAP block
, Y8 f( J3 {! B/ g: h/ }+ j$ G+ x, |2 C. D7 x$ z T
BUTTON CUSTOMER_BUTTON_5
6 N' R. N3 d4 o LABEL Menu Button58 L" j- R: W d: A1 r& l0 [
RIBBON_LABEL Ribbon Button5
, D; ]& I2 e3 Y2 A TOOLBAR_LABEL Toolbar Button5
5 E. R: m" C K; c! B BITMAP checkgreen
$ i3 H% i6 _; t j( @, w3 F4 [% U, W7 M
END_OF_MENU3 [1 W( m( u0 h) V& o/ n
9 ^2 u* P3 o" f
1 R/ `% N, X; z$ z
0 q8 k' U& D' r9 B) ]" ocustomer_ribbon_tab.rtb
: z/ G4 s7 T& Z) R7 A!# k9 X- @! ?0 \0 o
! Customer Ribbon Tab$ m# m4 w) D) i: X
! ! ^1 p% r ?: @( c
! This file will create a new customer tab containing three groups and
1 r+ L1 |; U) F) D$ j; m) q! one top level button.9 A6 P/ Q2 H2 A" D9 [
!8 m( p# C; Z; z8 v/ a& K8 H; G
; j- ^) }+ q' R6 G" j4 F, W! o
TITLE Customer Tab8 f$ u+ H4 c9 p+ ~+ h5 K/ l' \
VERSION 170
9 d# x& M2 E) n. w; L3 r Q% L- V9 K' n+ Y1 \
! The first group represents a Ribbon group that references an existing ! \) x/ u4 i* s/ V: N/ m8 B9 L
! toolbar with no Ribbon style changes.
' _4 g0 X" C4 L: F" t, @$ p! ; \# b: e3 c J# {
! This is the quickest way to add existing toolbar content into Ribbon mode.$ m! b9 P" {/ {" Y2 u
!
) E+ X. F9 Q& L- QGROUP customer_toolbar.tbr
/ W+ j9 x5 \, R- N) }5 ^3 M( A: \3 V2 B4 j, o5 \
! The second group represents a Ribbon group that references an existing
2 v5 B% p8 v2 J8 }. f$ ?2 h6 U! toolbar with Ribbon specific style changes added to it. There is no difference, Q5 T9 H; i" h
! in how this toolbar is referenced in the .rtb file compared to the first
, `- r" n' c o6 U9 }, ?# w, ^0 @! toolbar as a group. The only differences from the first group exist within 1 O' g5 w5 s- k% I7 j
! the .tbr file itself.+ C5 r$ E* V( {1 U4 `* D7 C1 i# C
!7 h' l; N, f% |* \: T0 }0 j
! This approach has advantages for customers that will deploy both Ribbon and
( L; ^; S1 {- c F! Classic Mode customizations since all the content is defined in the .tbr ( f' M% \9 y/ K# e; L: t; g$ K" A5 j
! file and it will stay synchronized in both modes. Only one set of customizations
) e: V) [+ A; U7 W7 i& x! will need to be maintained while still making use of RIBBON_STYLE to , R: G( A; S( f; m9 b" l/ Z
! control the presentation of the buttons on the Ribbon.( L+ q' S( o$ b
!0 Y2 R) l6 u% S. k( ^
GROUP customer_toolbar_alternate.tbr, c0 m5 L% I* ^$ R7 H2 i( q! s9 N1 Z" k
( |: A- K9 D6 S2 X8 u% C
! The third group represents a Ribbon group that has been created explicitly- Q I. D6 g5 M) V
! as a Ribbon group and will not exist in Classic Toolbar mode. This is the
$ v0 H" ]" F) F2 G/ _4 e& R! preferred option since the user will be able to take advantage of all the % D$ p V( h; Y
! layout styles and containers offered by the Ribbon. 0 D* W( x7 v* i; A+ j1 q' n1 C
!
& J+ X& J) I4 E/ i4 @0 x! For customers that will deploy both Ribbon and Classic Mode customizations,
( Y. C3 k k+ i1 G4 z! this approach will result in no synchronization and two sets of customizations
2 h6 o" H! }1 x( I/ m! will need to be maintained.
4 |( T) q( `$ x9 T6 a/ C!
" N9 R& u H- f a! A group can alternatively be defined directly inside the .rtb file by using the& E" z4 G) _. S* V( Y) ?+ p
! keywords BEGIN_GROUP and END_GROUP. - j* {0 w4 ?8 w) i; E' _
!! S L1 n y0 \2 F7 [) j* f
GROUP customer_group.grb9 Q0 X! D2 p/ f' g1 |
m4 r" [4 \7 N( F% b
! Example of a button that is placed directly on the Ribbon without being6 ?- W4 A9 O: {( S/ t+ o! s
! contained in a group. This is a simple way to add a button to a tab
4 F, V0 ^3 ~/ J0 S+ J0 {% W$ G! but is not recommended for many buttons since groups have advantages.
, a% U& {. n* O3 \!
) c9 M; z9 {7 h! A few advantages of groups:
/ M! ~) F1 q( S2 F# \! 1. Easier to move many buttons around together in quick customization. " u; B, {2 S/ j! c: M- T
! For example, MB3 on a group and choose "Add to Left Border Bar". 1 B8 Q" Z3 r& c' v6 A( Z. c3 i
! This will move the whole group to a new location. If buttons are 2 q- i5 U9 r& r( t
! not in a group, they need to be moved one at a time./ b( Y1 Y6 P2 s# S
!
, S1 A* I: [1 @! 2. Provide a label to describe its contents.
/ r( }- e% b9 V0 u0 a& N: F!
' S, \- W# R' vBUTTON CUSTOMER_BUTTON_18 B |, n# ]. R5 q% l, m& {$ I: z
LABEL Button1 Directly on Tab) j& X$ r% c. K: I
d' `, k1 ]! Z
e3 {3 M- e5 Q* }5 T g
9 {8 @9 v. |9 E7 ?1 ^& l Jcustomer_toolbar.tbr
) S6 T) H8 ^, T. p3 M!/ m# h: {6 S+ n* q7 H+ F9 y6 n
! Customer Toolbar File
- G/ r8 B# Y+ z! h8 M!* j9 v' o# P1 U4 p. F# P
! This is similar to an existing toolbar file containing3 O) ~; J2 M3 H
! no Ribbon changes.
! {$ y- b+ [* w! U( q!
: N- h7 D! P* a, S [! In Classic Toolbars mode - This toolbar will still show up in the x5 R* f9 |/ ^ Y) _
! toolbars list.# G& s% Q( t2 y& Y2 @# s L, n
!( Y! f d$ A) f7 G& g
! In Ribbon mode - This toolbar will be automatically converted to a
7 L9 Y2 \. f1 F, U- n: k. h4 \! Ribbon group and will appear in the "Classic Toolbars as Groups"; g7 Y4 ~* F e( U
! section in the Customize dialog.
9 y' r4 E$ @) e6 G5 U( Z$ q!
2 t% p. w+ H4 o& r) U( v& L* G; D$ t6 j. Z
TITLE Toolbar
7 y0 P7 l! B6 T3 n8 R) FVERSION 1709 G! D, d: m0 {0 C
. X2 d4 W& B" p% ^1 B) h' vBUTTON CUSTOMER_BUTTON_1
- F# ^2 \9 o5 `- j! u$ v; Y+ ?) j9 ]- t& j
BUTTON CUSTOMER_BUTTON_2
8 g( e1 E& Z; p0 k' }: ]; }- p. E% Q5 o! w% W" @# Q7 A% y
BUTTON CUSTOMER_BUTTON_3
9 u" w o c: d9 I0 N2 Q# @, ?% \" F& \ A3 l) k P
BUTTON CUSTOMER_BUTTON_4
: g: a0 N6 x! `
' ~+ L% }! t2 G8 Q5 D/ M" x5 UBUTTON CUSTOMER_BUTTON_5
' U. L6 K9 C$ K3 |, K. p ~! R9 E- P1 i+ T0 I
5 c; T X( g! `- Y. |
& p) N4 _. o8 |0 Ucustomer_toolbar_alternate.tbr ?. u: D D' s: b( r
!( K6 [& U$ r* V; V' f q
! Customer Toolbar File (Alternate)
$ Q- u# T& v) s, q!
6 @" r) {4 A9 J! This is similar to an existing toolbar file with new
# F) {0 U$ X, ]/ k6 q q: I5 f/ Z! Ribbon styles added.7 L7 G" {& {; T4 `: X& a
! % ^: r+ n4 B7 i& i
! The RIBBON_STYLE will be honored when the toolbar is loaded " A7 H0 ^' V# ~ J) t" p
! in Ribbon mode as a group but will be ignored when the toolbar
: m8 e A% e' m6 z$ _/ X! is displayed in Classic Toolbars mode.
% f* v/ q6 w+ K0 O4 z!
& E# b/ E" k' e: F m+ ?1 q& f) G! h! In Classic Toolbars mode - This toolbar will still show up in the ' q: Y% H2 L/ R
! toolbars list.& y9 A/ F- B8 a
!
; |6 {- U* m7 e$ w$ c- M2 l! In Ribbon mode - This toolbar will be automatically converted to a ( g: `# v- A0 A: y7 C: d t, {7 m
! Ribbon group and will appear in the "Classic Toolbars as Groups"
+ E9 h0 A+ L% \! section in the Customize dialog.. N5 N' i. @- k
!
" K6 ` o& Q; a' \. |6 p% M& F# i; F2 d! _* x
TITLE Toolbar (Alternate)6 z9 }1 M% G' N5 Y! L4 q
VERSION 1700 C1 e( \& w. E4 `6 V( f* F
( t( L3 X" v3 }: k+ B! y! `/ u
BUTTON CUSTOMER_BUTTON_1$ y8 Z/ [" v* E) Q- r: D
LABEL Toolbar(Alt) Button19 K- E6 l9 Y8 @ b, u: c7 l5 x7 ]
RIBBON_STYLE LARGE_IMAGE: q: A1 K9 M7 g: ~
/ a# K3 G: }& h: R1 M
BUTTON CUSTOMER_BUTTON_2- b) y* T. U6 E0 v2 r
LABEL Toolbar(Alt) Button2
% {3 h3 U- o/ y# K) R hRIBBON_STYLE LARGE_IMAGE
' L0 e+ C6 c" H: n
7 D" a4 r- a, ?BUTTON CUSTOMER_BUTTON_3
' p: J9 s6 l9 ^LABEL Toolbar(Alt) Button3
' t) F4 J) h0 ?: T% N7 n6 x# z3 N: FRIBBON_STYLE SMALL_IMAGE_AND_TEXT
$ w1 u8 w& K: `* l; {- [0 S: I& e$ e" w
BUTTON CUSTOMER_BUTTON_4& x# J3 [5 f/ F; Z
LABEL Toolbar(Alt) Button4 g) T; \& j1 s8 v
RIBBON_STYLE SMALL_IMAGE_AND_TEXT0 x8 Z5 P- |! }: o7 ~: T7 s
, d4 F) a+ T, `1 n
BUTTON CUSTOMER_BUTTON_5
' R6 a+ [0 i6 ~% ILABEL Toolbar(Alt) Button5/ _ z0 Q T, P
RIBBON_STYLE SMALL_IMAGE_AND_TEXT! z$ n8 _* Q; H; ~
# ~1 }$ C- z. q9 y6 n; r8 V4 E0 c: E$ s
- s! V- z% _- [customer_group.grb2 k: V- e# V i( \- P) G! l
!
5 W$ @ v; ]& f, \8 l7 A- E! Customer Ribbon Group File& d& i; h" O0 P" A
!. F7 G c2 L6 w. A; p
! In Classic Toolbars mode - This group will be unavailable
6 r' k5 B" w1 A; ~!
* k. I# N4 t3 @2 }! In Ribbon mode - This group will show up in the "All Groups" list
9 `/ j$ Q& p( p: V2 f! in the Customize dialog.
0 `9 i" `6 X. v2 A5 s1 h!
, t. `9 l2 V& I: ~" `! The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
6 O. s! X8 ?2 s5 ~!8 z U2 g3 R1 o2 `0 z- U5 I$ u
- a) ^% C& u4 {8 a; @7 u6 E! {
TITLE Group
, s& ~1 H: |1 Z' b: d) p6 Q0 F9 \VERSION 170
3 \8 G) F1 ~% P
' a" \7 M! B# M E! No LABEL defined, using RIBBON_LABEL defined in customer_men.men. B( R9 {4 |$ L0 W- t
BUTTON CUSTOMER_BUTTON_1
, c/ d. e- C8 u1 V& ?) o S iRIBBON_STYLE LARGE_IMAGE7 r9 u$ w) Z+ e- t# r; @) s
$ w6 S# c+ g$ B8 G X) u) i
! Example of a gallery defined in a GRB file.# C$ h. g; o0 I& a5 G* y
!
" S. C& s3 Z2 [. S" i* Z1 k! If this gallery is to be used in other places, then it could be - P8 @1 i! B" b' V$ k+ d7 R2 m
! defined in its own gallery (GLY) file and referenced here
8 \1 }7 y+ y+ ~4 B4 K/ i! Example:
" {: `. c! [, V8 }: Q0 ^/ a! GALLERY customer_gallery.gly7 C/ n' H" Y& h5 [
!
4 }3 n1 t, `& h# bBEGIN_GALLERY CUSTOMER_GALLERY- z' J1 f, y# y$ ? X
COLUMN_IN_RIBBON 25 s/ C8 Z( v9 Q6 M
COLUMN_IN_POPUP 2
& X1 q1 n8 v4 f% x. uLABEL Gallery
s( y2 y" H4 T; H/ F* ? gGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT4 F: h R9 z: |
2 u* Q/ n- L0 I9 z. B0 B0 {5 d
BUTTON CUSTOMER_BUTTON_2
, r0 C% K" \! s( s& l
2 T/ ]! v% E$ C8 n BUTTON CUSTOMER_BUTTON_3, N C: S2 C. `( j# s
1 G0 m2 _% p( y% b, D* K# m! a BUTTON CUSTOMER_BUTTON_4
' a3 w p* e: N9 L5 K& Y
+ @6 e2 X# S1 ~5 n% _ BUTTON CUSTOMER_BUTTON_5# h7 g' u. T; l6 \
; w8 \7 Z0 V$ V/ I- q+ h" K, D7 xEND_GALLERY7 e" s5 f" m* y( }2 v: f: c
. [% Q9 W7 ~( B" T5 b4 ~+ L& i4 Z; z
2 k* k8 A" D6 b1 e- B* y, O |
|