竞争力英文
⼩⽩学UG⼆次开发_UGOpenUIStlyer对话框设计
⼩⽩学UG⼆次开发 UGOpen UIStlyer 对话框设计
本例参考《UG/Open API、MFC和COM 开发实例精解》黄勇,本例基本参照书中内容操作,没有做太⼤修改,能正常运⾏。
绯闻女孩第六季10
第⼀步,准备⼯作
在UGII_USER_DIR⽬录⾥新建startup,application两个⽂件夹。书中是这么说的,但是我只⽤到了application,startup我没有⽤到。怎么设置环境变量我就不说了。
第⼆步,设计UI.
UG 开始-》所有应⽤模块-》NX 6 之前版本UI样式编辑器选之前的版本主要为了降低开发难度。进⼊UIStyler 对话框设计环境,新建⽂件。
⾥⾯有很多控件,⾃⼰试着点点看,探索下。⾥⾯有对象浏览器,对话框和资源编辑器,对话框的标题和提⽰如下图所⽰,前缀名⽐较重要,直接关系到后续程序⽣成后的⼀些参数名称,我们这边设置为DIALOG_ACCESS。设置如图所⽰的整数、实数、字符串和按钮控件,导航按键中按钮样式选项⾥选择
的不同项会影响到后续的回调函数。这⾥选择关闭。整数,实数,字符串修改下标签和标识符。这个会在对象浏览器⾥反应出来。⽬前我还不会修改类型,就放着没管,如果有知道的,请帮忙解释下类型。
另外,我对回调函数的名称⽣成机制也不是很清楚,只是知道Back_cb应该是关闭对话框时触发的回调函数,action_3_act_cb 是按钮空间触发的回调函数,名字和书上不太⼀样,但是能正常实现功能。
完成后,另存为对话框到application,语⾔选C,对话框名称为access_dialog,在⽬录下会⽣成
teddybearaccess_dialog.dlg,access_dialog.h,access_dialog_template.c 三个⽂件,进⼊⽂件夹,将最后⼀个⽂件改成
access_dialog.cpp并保存。
按之前帖⼦的⽅法建⽴⼀个DDL⼯程,注意⽬录放在UGII_USER_DIR下,名称也为Dialog_Access.将access_dailog.h和access_dialog.cpp复制到⼯程中,添加到头⽂件和源⽂件中。
关于教师节的黑板报/*============================================== ===============================
WARNING!! This file is overwritten by the UIStyler each time the Styler file is saved.
Filename: access_dialog_template.c
This file was generated by the NX Ur Interface Styler
Created by: Daniel
Version: NX 8.5
Date: 03-23-2015
Time: 19:32
This template file is overwritten each time the UIStyler dialog is
saved. Any modifications to this file will be lost.
=============================================== ===============================*/
/*============================================== ================================
Purpo: This TEMPLATE file contains C source and static structures
to
guide you in the construction of your NX Open application dialog.
The generation of your dialog file (.dlg extension) is the first step towards dialog construction within Unigraphics. You must now create a UGOpen
application that utilizes this file (.dlg).
⽣成对话框⽂件dig是第⼀步,然后要利⽤dlg⽂件创建⼀个UGOpen应⽤
katie meluaThe information in this file provides you with the following:
1. Help on the u of the
functions, UF_MB_add_styler_actions and
UF_STYLER_create_dialog in your NX Open application. The functions
will load and display your UIStyler dialog in Unigraphics.
两个重要函
数
An example of the function, UF_MB_add_styler_actions to associate your
dialog to the menubar is shown below (Search on Example
1).
这个example1 和2 在哪⾥?谁知
道?
An example of a invoking a dialog from a callback utilizing
UF_STYLER_create_dialog is also shown below (Search for Example 2).
An example of a ur exit utilizing UF_STYLER_create_dialog is also
shown below (Search for Example 3).
2. The callback structure(回调结构体?不知道是不是这么翻译的): --- DIALOG_ACCESS_cbs ---
This structure is VERY important if you have callbacks associated with your dialog. It correlates the dialog items in your dialog with the
callback functions you must supply.You should not modify this
structure since it MUST match up to the information stored in your
dialog file (.dlg). ⽤以链接对话框项⽬(item)和回调函数,其必须和dlg ⽂件匹配,不要修改。Any attempt to do so will cau an error while constructing your dialog. If you wish to modify the association of
your callbacks to your dialog, plea reload your dialog file (.dlg) into the UIStyler and regenerate your files.
You do not need to be concerned about this structure, simply pass it as an argument to the function,
UF_STYLER_create_dialog along with your
dialog file (.dlg).
Example 1 displays the actual call you may make for this particular
dialog.
3. The empty callback functions (stubs) associated with your dialog items
have also been placed in this file. The empty functions have been
created simply to start you along with your coding requirements.
The function name, argument list and possible return values have already
been provided for you.
⽂件中也已经⽣成了空的回调函数,后续要实现啥功能,就要在⾥⾯编
程。
NOTE: Each callback must be wrappered with the functions
chinanet是什么UF_initialize()
and UF_terminate().
=============================================== ===============================*/
/* The include files are needed for the following template code. */ #include
#include
#include
#include
#include
isaac#include
#include
#include "access_dialog.h"//这⾥要⽤引号
/* The following definition defines the number of callback entries */
/* in the callback structure: */
/* UF_STYLER_callback_info_t DIALOG_ACCESS_cbs */
#define DIALOG_ACCESS_CB_COUNT ( 3 + 1 ) /* Add 1 for the terminator */ /*--------------------------------------------------------------------------
The following structure defines the callback entries ud by the
styler file. This structure MUST be pasd into the ur function,
UF_STYLER_create_dialog along with
DIALOG_ACCESS_CB_COUNT.
--------------------------------------------------------------------------*/
static UF_STYLER_callback_info_t
DIALOG_ACCESS_cbs[DIALOG_ACCESS_CB_COUNT] =
{
{UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB , 0,
DIALOG_ACCESS_apply_cb},
{UF_STYLER_DIALOG_INDEX, UF_STYLER_BACK_CB , 0,
DIALOG_ACCESS_back_cb},
{DIALOG_ACCESS_BUTTON , UF_STYLER_ACTIVATE_CB , 0, DIALOG_ACCESS_action_3_act_cb},
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
};
这⾥我还没怎么搞明⽩,先不管。不过应该是和后续回调函数调⽤时需要⽤到的⼀些结构体。
/*--------------------------------------------------------------------------
UF_MB_styler_actions_t contains 4 fields. The are defined as follows: Field 1 : the name of your dialog that you wish to display.
Field 2 : any client data you wish to pass to your callbacks.
Field 3 : your callback structure.
Field 4 : flag to inform menubar of your dialog location. This flag MUST match the resource t in your dialog! Do NOT ASSUME that changing
this field will update the location of your dialog. Plea u the
UIStyler to indicate the position of your dialog.
--------------------------------------------------------------------------*/
static UF_MB_styler_actions_t actions[] = {onceinawhile
{ "access_dialog.dlg", NULL, DIALOG_ACCESS_cbs, UF_MB_STYLER_I S_NOT_TOP },
{ NULL, NULL, NULL, 0 } /* This is a NULL terminated list */
};
这个我也没特别闹明⽩,但是应该是菜单栏调⽤UI需要采⽤该结构体数组。
/*---------------- MENUBAR HOOKUP HELP Example -------------------
这⾥是从菜单栏调⽤UI的⽅法,本例忽略,后续会去试⼀试
To launch this dialog from a Unigraphics menubar, you must follow
the steps below.
postscript下载
1) Add the following lines to your MenuScript file in order to
associate a menu bar button with your dialog. In this
example, a cascade menu will be created and will be
located just before the Help button on the main menubar.
The button, ACCESS_DIALOG_BTN is t up to launch your dialog and will be positioned as the first button on your pulldown menu.
georgetown
If you wish to add the button to an existing cascade, simply
add the 3 lines between MENU LAUNCH_CASCADE and END_OF_MENU to your menuscript file.
The MenuScript file requires an extension of ".men".