admin 发表于 2015-1-9 10:37:48

关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧

关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧

在经典界面下,需要的文件

[*]customer_men.men
[*]customer_toolbar.tbr
在ribbon界面下你可能需要的文件

[*]customer_men.men
[*]customer_tab.rtb
[*]customer_toolbar.tbr
[*]customer_toolbar_alternate.tbr
[*]customer_group.grb


举例如下:


customer_men.men
!
!Customer menu file
!
!Contains button definitions to be used in
!toolbars and Ribbon files
!

VERSION 120

EDIT UG_GATEWAY_MAIN_MENUBAR

TOP_MENU
    CASCADE_BUTTON CUSTOMER_MENU
    LABEL Customer Menu

END_OF_TOP_MENU

MENU CUSTOMER_MENU

    BUTTON CUSTOMER_BUTTON_1
    LABEL Menu Button1
        RIBBON_LABEL Ribbon Button1
        TOOLBAR_LABEL Toolbar Button1
    BITMAP fileopen

    BUTTON CUSTOMER_BUTTON_2
    LABEL Menu Button2
        RIBBON_LABEL Ribbon Button2
        TOOLBAR_LABEL Toolbar Button2
    BITMAP filesave

    BUTTON CUSTOMER_BUTTON_3
    LABEL Menu Button3
        RIBBON_LABEL Ribbon Button3
        TOOLBAR_LABEL Toolbar Button3
    BITMAP current_feature

    BUTTON CUSTOMER_BUTTON_4
    LABEL Menu Button4
        RIBBON_LABEL Ribbon Button4
        TOOLBAR_LABEL Toolbar Button4
    BITMAP block

    BUTTON CUSTOMER_BUTTON_5
    LABEL Menu Button5
        RIBBON_LABEL Ribbon Button5
        TOOLBAR_LABEL Toolbar Button5
    BITMAP checkgreen

END_OF_MENU



customer_ribbon_tab.rtb
!
!Customer Ribbon Tab
!
!This file will create a new customer tab containing three groups and
!one top level button.
!

TITLECustomer Tab
VERSION 170

!The first group represents a Ribbon group that references an existing
!toolbar with no Ribbon style changes.
!
!This is the quickest way to add existing toolbar content into Ribbon mode.
!
GROUPcustomer_toolbar.tbr

!The second group represents a Ribbon group that references an existing
!toolbar with Ribbon specific style changes added to it.There is no difference
!in how this toolbar is referenced in the .rtb file compared to the first
!toolbar as a group.The only differences from the first group exist within
!the .tbr file itself.
!
!This approach has advantages for customers that will deploy both Ribbon and
!Classic Mode customizations since all the content is defined in the .tbr
!file and it will stay synchronized in both modes.Only one set of customizations
!will need to be maintained while still making use of RIBBON_STYLE to
!control the presentation of the buttons on the Ribbon.
!
GROUPcustomer_toolbar_alternate.tbr

!The third group represents a Ribbon group that has been created explicitly
!as a Ribbon group and will not exist in Classic Toolbar mode.This is the
!preferred option since the user will be able to take advantage of all the
!layout styles and containers offered by the Ribbon.
!
!For customers that will deploy both Ribbon and Classic Mode customizations,
!this approach will result in no synchronization and two sets of customizations
!will need to be maintained.
!
!A group can alternatively be defined directly inside the .rtb file by using the
!keywords BEGIN_GROUP and END_GROUP.
!
GROUPcustomer_group.grb

!Example of a button that is placed directly on the Ribbon without being
!contained in a group.This is a simple way to add a button to a tab
!but is not recommended for many buttons since groups have advantages.
!
!A few advantages of groups:
!   1. Easier to move many buttons around together in quick customization.
!      For example, MB3 on a group and choose "Add to Left Border Bar".
!      This will move the whole group to a new location.If buttons are
!      not in a group, they need to be moved one at a time.
!
!   2. Provide a label to describe its contents.
!
BUTTON CUSTOMER_BUTTON_1
LABEL Button1 Directly on Tab



customer_toolbar.tbr
!
!Customer Toolbar File
!
!This is similar to an existing toolbar file containing
!no Ribbon changes.
!
!In Classic Toolbars mode - This toolbar will still show up in the
!   toolbars list.
!
!In Ribbon mode - This toolbar will be automatically converted to a
!   Ribbon group and will appear in the "Classic Toolbars as Groups"
!   section in the Customize dialog.
!

TITLE Toolbar
VERSION 170

BUTTON CUSTOMER_BUTTON_1

BUTTON CUSTOMER_BUTTON_2

BUTTON CUSTOMER_BUTTON_3

BUTTON CUSTOMER_BUTTON_4

BUTTON CUSTOMER_BUTTON_5



customer_toolbar_alternate.tbr
!
!Customer Toolbar File (Alternate)
!
!This is similar to an existing toolbar file with new
!Ribbon styles added.
!
!The RIBBON_STYLE will be honored when the toolbar is loaded
!in Ribbon mode as a group but will be ignored when the toolbar
!is displayed in Classic Toolbars mode.
!
!In Classic Toolbars mode - This toolbar will still show up in the
!   toolbars list.
!
!In Ribbon mode - This toolbar will be automatically converted to a
!   Ribbon group and will appear in the "Classic Toolbars as Groups"
!   section in the Customize dialog.
!

TITLE Toolbar (Alternate)
VERSION 170

BUTTON CUSTOMER_BUTTON_1
LABEL Toolbar(Alt) Button1
RIBBON_STYLE LARGE_IMAGE

BUTTON CUSTOMER_BUTTON_2
LABEL Toolbar(Alt) Button2
RIBBON_STYLE LARGE_IMAGE

BUTTON CUSTOMER_BUTTON_3
LABEL Toolbar(Alt) Button3
RIBBON_STYLE SMALL_IMAGE_AND_TEXT

BUTTON CUSTOMER_BUTTON_4
LABEL Toolbar(Alt) Button4
RIBBON_STYLE SMALL_IMAGE_AND_TEXT

BUTTON CUSTOMER_BUTTON_5
LABEL Toolbar(Alt) Button5
RIBBON_STYLE SMALL_IMAGE_AND_TEXT



customer_group.grb
!
!Customer Ribbon Group File
!
!In Classic Toolbars mode - This group will be unavailable
!
!In Ribbon mode - This group will show up in the "All Groups" list
!   in the Customize dialog.
!
!The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
!

TITLE Group
VERSION 170

!No LABEL defined, using RIBBON_LABEL defined in customer_men.men
BUTTON CUSTOMER_BUTTON_1
RIBBON_STYLE LARGE_IMAGE

!Example of a gallery defined in a GRB file.
!
!If this gallery is to be used in other places, then it could be
!defined in its own gallery (GLY) file and referenced here
!Example:
!    GALLERY customer_gallery.gly
!
BEGIN_GALLERYCUSTOMER_GALLERY
COLUMN_IN_RIBBON 2
COLUMN_IN_POPUP 2
LABEL Gallery
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT

    BUTTON CUSTOMER_BUTTON_2

    BUTTON CUSTOMER_BUTTON_3

    BUTTON CUSTOMER_BUTTON_4

    BUTTON CUSTOMER_BUTTON_5

END_GALLERY


页: [1]
查看完整版本: 关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧