ANSA二次开发 - BCGUI Designer

The designer is a tool that enables the easy generation of windows using a graphical user interface. The functions used for creating the interface belong to the BCGUI function group that was presented in the previous section. The great advantage of the designer is the automatic generation of code that reduces the preparation time of a script. The following paragraphs will focus in the presentation of the designer’s interface but without any particular emphasis on the BCGUI functions that are used in the background.

设计器是一种工具,可以使用图形用户界面轻松生成窗口。用于创建接口的函数属于上一节中介绍的BCGUI函数组。这大大减少了设计者编写脚本的时间。以下段落将重点介绍设计器的界面,但没有特别强调后台使用的BCGUI函数。

The designer is accessed through the Script Editor with the function Tools>Designer. It’s interface as initially is launched, contains the following sections:

通过“脚本编辑器”(Script Editor)使用“功能工具>设计器”(function Tools>designer)访问设计器。它最初启动时的界面包含以下部分:

ToolBox

工具箱

This is the window that hosts all the functions for creating widgets, layouts or items.

这是一个包含所有创建小部件、布局或项目的函数的窗口。

List with Constructed Items

施工项目清单

This is a tree list with all created items.

这是一个包含所有已创建项的树列表。

Common Parameters (BC)

公共参数(BC)

This window lists all the parameters that are common for each BCGUI item.

此窗口列出每个BCGUI项的所有通用参数。

Parameters

参数

This window displays all the parameters related to the selected item of the List with Constructed Itemswindow.

此窗口显示与已构造项swindow的列表中选定项相关的所有参数。

CallBack Functions

回调函数

This is the window where it hosts all created callback functions.

这是它承载所有创建的回调函数的窗口。

Source Code

源代码

This is the area where the automatically created code resides.

这是自动创建的代码所在的区域。

Help

帮助

This is the area where the help text of the selected parameter is displayed.

这是显示所选参数的帮助文本的区域。

The ToolBox is the starting point of all actions performed in designer. It hosts in separate tabs all the necessary functions for creating the main window, buttons, containers, views, widgets and input items. Initially, only the Window tab is active since this will create the window that will be used as the parent of all features. Expand the Window tree and press the Apply Settings button to create the main window with the name ‘TopWindow’.

工具箱是设计器中执行的所有操作的起点。它在单独的选项卡中托管创建主窗口、按钮、容器、视图、小部件和输入项所需的所有功能。最初,只有“窗口”选项卡处于活动状态,因为这将创建一个将用作所有功能的父级的窗口。展开窗口树并按Apply Settings按钮以创建名为“TopWindow”的主窗口。

This will make the rest of categories available.

这将使其他类别可用。

Expanding any object under any category will reveal a set of basic options necessary for the creation of the object. These options are actually the input arguments of a BCGUI function and thus they are characterized by their type (integer, string, element etc) and their value. The options initially have the default values but they can be also set up by the user, except those that are of element type. The button Apply Settings always creates the object. In the following example a button and a check box have been created under the top window.

展开任何类别下的任何对象都会显示创建对象所需的一组基本选项。这些选项实际上是BCGUI函数的输入参数,因此它们由其类型(整数、字符串、元素等)及其值来表征。选项最初具有默认值,但也可以由用户设置,元素类型的选项除外。“应用设置”按钮始终创建对象。在下面的示例中,在顶部窗口下创建了一个按钮和一个复选框。

The parent object controls the objects’ order. As it is shown above, any object that is added directly to the top window is distributed vertically. To control the order create a predefined horizontal HBox or a vertical box layout VBox, or a BoxLayout with controllable orientation and add the two widgets within.

父对象控制对象的顺序。如上所示,任何直接添加到顶部窗口的对象都是垂直分布的。要控制顺序,请创建预定义的水平HBox或垂直框布局VBox,或具有可控方向的BoxLayout,并在其中添加两个小部件。

All the created objects are listed under the List of Constructed Items. The list has a tree structure where it is easy to recognize any parent-child relationship or objects’ classes.

所有创建的对象都列在构造项列表下。这个列表有一个树状结构,很容易识别任何父子关系或对象的类。

Actions like drug and drop are allowed and thus the position of an object can be altered any time.

像药物和滴落这样的动作是允许的,因此物体的位置可以随时改变。

Pressing on an object of the list, highlights with yellow the corresponding object of the TopWindow. On the contrary, pressing <Ctrl+Left mouse button> over an object of the TopWindow, highlights the object on the list.

按下列表中的一个对象,用黄色高亮显示顶部窗口的相应对象。相反,在顶部窗口的对象上按<Ctrl+mouse Left button>会高亮显示列表中的对象。

Any object can be deleted either pressing the Delete button of the keyboard or with the Delete Item option under the right mouse button

按键盘上的“删除”按钮或鼠标右键下的“删除项目”选项,可以删除任何对象

The Common Parameters (BC) window lists all the options that are considered as common for all individual objects. The name and the input arguments of the parameters are displayed in two separate columns.

“公用参数”(BC)窗口列出了所有单个对象都视为公用的所有选项。参数的名称和输入参数显示在两个单独的列中。

In order to change the default parameter options, expand the parameter and type where it is allowed the new value. At the end, press the Apply Settings button to confirm the changes. In the following image, a tooltip is going to be added for the button ‘BCPushButton_1’. Select the button object from the List With Constructed Items or from the screen and type the tooltip text under the Values column of the tip parameter. After confirmation, place the cursor over the button to see the tooltip.

默认情况下,允许对新参数值进行更改。最后,按应用设置按钮确认更改。在下图中,将为按钮“bcputton_1”添加工具提示。从包含构造项的列表中或从屏幕中选择按钮对象,然后在“提示”参数的“值”列下键入工具提示文本。确认后,将光标放在按钮上以查看工具提示。

The Parameters window lists all the unique options of a selected object. As soon as an object is selected either from the screen or from the List With Constructed Items, the title of the Parameters window and the actual parameters change accordingly. The picture below shows the Parameters window when the check box is selected. The name and the input arguments of the parameters are displayed in two separate columns.

“参数”窗口列出选定对象的所有唯一选项。一旦从屏幕或具有构造项的列表中选择了对象,参数窗口的标题和实际参数就会相应地更改。下图显示了选中该复选框时的“参数”窗口。参数的名称和输入参数显示在两个单独的列中。

The name of each parameter describes its use.As in any other list of parameters , the corresponding options have the default values but they can get new ones by the user. For example, to change the name of the button expand the ‘ButtonSetText’ and type a new value for the option ‘text’. At the end, press the Apply Settings button to confirm the changes.

每个参数的名称描述其用作在任何其他参数列表中,相应的选项具有默认值,但用户可以获取新的值。例如,要更改按钮的名称,请展开“buttonsetext”并为选项“text”键入新值。最后,按应用设置按钮确认更改。

Those parameters that their name ends in ‘Function’, set up the callback functions of the object. In order to find all parameters related to callback functions, activate the filter and type ‘function’ in the Parameters field:

那些名称以“Function”结尾的参数设置对象的回调函数。要查找与回调函数相关的所有参数,请激活筛选器并在“参数”字段中键入“function”:

Two callbacks of different type have been filtered. The user can change any option according to his needs. When the Apply Settings button is pressed the callback type and its name automatically are listed under the CallBack window. The title of the window indicates the parent object type:

已筛选出两个不同类型的回调。用户可以根据需要更改任何选项。当按下“应用设置”按钮时,回调类型及其名称将自动列在回调窗口下。窗口的标题指示父对象类型:

The last argument of all callback functions can be of any type and corresponds to user data.

所有回调函数的最后一个参数可以是任何类型,并对应于用户数据。

Each parameter corresponds to a BCGUI function. Selecting either a common parameter or a unique parameter, the Help area displays the help text of the parameter-function.

每个参数对应一个BCGUI函数。选择通用参数或唯一参数,帮助区域将显示参数函数的帮助文本。

The help text of functions that set up callbacks, contain also the syntax of the callback. Thus, the user is also informed about the input arguments and the return values of it.

设置回调的函数的帮助文本也包含回调的语法。因此,用户还被告知输入参数及其返回值。

The Source Code window is the area where the designer automatically writes the code as soon as an action is performed. An action is performed every time the Apply Settings button is pressed or when the tree under the List With Constructed Items is updated with manual movements. The generated code consists of one main function and any number of callback functions.

源代码窗口是设计器在执行操作后自动编写代码的区域。每次按下“应用设置”按钮或手动移动更新已构建项目列表下的树时,将执行一个操作。生成的代码由一个主函数和任意数量的回调函数组成。

The source code is not editable and changes automatically only when an action is performed or when an object is deleted. However, it can be totally cleared without destroying the created window through the Code>Clear Source Code. The next time an action will be performed, the source code will be again generated.

源代码是不可编辑的,只有在执行操作或删除对象时才会自动更改。但是,它可以完全清除,而不必通过Code>Clear Source Code破坏创建的窗口。下一次将再次执行源代码操作。

The source code, including the main function and the callbacks that are constructed by the designer tool, will be probably only a small portion of an extensive script. The rest of the code must be manually added by the user through the script editor. The script code can be saved as any other script through the File>Save and then can be reopened by the script editor for further editing. Alternatively, it can be directly sent to the editor through the Code>Set Code to Script Editor.

很可能只有一小部分的源代码是由设计器构建的,包括主函数的回调。其余代码必须由用户通过脚本编辑器手动添加。脚本代码可以通过“文件”>“保存”另存为任何其他脚本,然后可以由脚本编辑器重新打开以进行进一步编辑。或者,可以通过“代码>将代码设置为脚本编辑器”(Code>Set Code to Script editor)直接将其发送到编辑器。

Note

注意

The designer cannot be used for opening scripts unless it is free of user defined code.

设计器不能用于打开脚本,除非它没有用户定义的代码。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
大学生参加学科竞赛有着诸多好处,不仅有助于个人综合素质的提升,还能为未来职业发展奠定良好基础。以下是一些分析: 首先,学科竞赛是提高专业知识和技能水平的有效途径。通过参与竞赛,学生不仅能够深入学习相关专业知识,还能够接触到最新的科研成果和技术发展趋势。这有助于拓展学生的学科视野,使其对专业领域有更深刻的理解。在竞赛过程中,学生通常需要解决实际问题,这锻炼了他们独立思考和解决问题的能力。 其次,学科竞赛培养了学生的团队合作精神。许多竞赛项目需要团队协作来完成,这促使学生学会有效地与他人合作、协调分工。在团队合作中,学生们能够学到如何有效沟通、共同制定目标和分工合作,这对于日后进入职场具有重要意义。 此外,学科竞赛是提高学生综合能力的一种途径。竞赛项目通常会涉及到理论知识、实际操作和创新思维等多个方面,要求参赛者具备全面的素质。在竞赛过程中,学生不仅需要展现自己的专业知识,还需要具备创新意识和解决问题的能力。这种全面的综合能力培养对于未来从事各类职业都具有积极作用。 此外,学科竞赛可以为学生提供展示自我、树立信心的机会。通过比赛的舞台,学生有机会展现自己在专业领域的优势,得到他人的认可和赞誉。这对于培养学生的自信心和自我价值感非常重要,有助于他们更加积极主动地投入学习和未来的职业生涯。 最后,学科竞赛对于个人职业发展具有积极的助推作用。在竞赛中脱颖而出的学生通常能够引起企业、研究机构等用人单位的关注。获得竞赛奖项不仅可以作为个人履历的亮点,还可以为进入理想的工作岗位提供有力的支持。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值