Writer:高级窗体定制

出自OOo 中文指南手册翻译

跳转到: 导航, 搜索

目录

[编辑] 连接宏到窗体的控件上

您可以绑定某一事件到窗体控件(如文本框、按钮等),以便执行某些操作。在设计模式下,在控件上点击右键,选择快捷菜单的 控件 ,然后选择 属性 对话框中 事件 选项卡来查看所有可选的事件。 You can set any form control (for example, text box or button) to perform an action when triggered by some event. To see the full list of events, right-click on the form control when the design mode is on, select Control and click on the Events tab.

控件属性对话框中事件选项卡。

为某一事件指定宏的操作是: To assign a macro to an event:

  1. 创建宏。请参考《新手指南》第13章(宏入门)的相关内容。 Create the macro. See Chapter 13 (Getting Started with Macros) in the Getting Started guide.
  2. 右击控件,选择快捷菜单的 控件,然后点击 属性 对话框中 事件 选项卡。 Right-click on the form control, select Control and click on the Events tab.
  3. 点击事件右边的 ...按钮,打开 指定操作 对话框。 Click the ... button to the right of the event to bring up the Assign action dialog box.
  4. 点击按钮,选择某一宏。 Click Assign and select the macro.
指定操作对话框。

也可以为窗体事件指定宏。请选择窗体控件快捷菜单上的 窗体 ,点击对话框的 事件 卡。 Macros can also be assigned to events relating to the form as a whole. To assign these, right-click on a form control in the document, select Form and click on the Events tab.

[编辑] 设置文档为只读

创建窗体后,您可能不希望对用户修改创建好的窗体的版式,而只能查看或输入已有的数据。其实很简单,只要把文档设置成自读的就可以了。操作如下: Having created your form, you want whoever is using it to be able to access the information stored in the database, or complete the form, without changing the layout. There is an easy way to do this: make the document read-only.

选择菜单项 工具 > 选项 > OpenOffice.org > 安全性 > 以只读方式打开此文档 Select Tools > Options > OpenOffice.org > Security> Open this document in read only mode.

[编辑] 细调数据库的访问权限 Fine-tuning database access permissions

默认下,窗体访问数据库时具有所有权限:能够增加、删除或者修改记录。很多情况下,您不需要都允许这些权限。例如,只允许用户增加记录,或者禁止修改已有的记录。 By default, when a database is accessed from a form, any changes can be made to it: records can be added, deleted and amended. You may not want that behavior. For example, you may want users to be able only to add new records or to be prohibited from deleting existing records.

请在设计模式里右击窗体的一个控件,然后选择快捷菜单上的 窗体 。选择弹出的 表单属性 对话框中的 数据 设置卡,把相应的 新增数据允许修改允许删除 只新增数据 根据需要选择或者 In design mode, right-click on a form control and select Form from the pop-up menu. On the Data tab of the Form Properties dialog box are a number of options: Allow additions, Allow deletions, Allow modifications and Add data only. Set each of these to Yes or No to control the access users have to the data source.

也可以对字段独自进行保护。当只允许用户修改记录中的一些字段时,这个功能就非常重要了。如股票列表中的股票介绍不需要修改,只需要修改股票的价值。 Individual fields can also be protected. This might be useful if you wanted a user to be able to modify some parts of a record but only view others, such as a stock list where item descriptions are fixed and quantities can be modified.

把某个字段设置为只读的步骤是:在设计模式下点击该字段,然后选择快捷菜单中的 控件,打开弹出的 属性 对话框中的 常规 设置卡,把 只读 修改为 To make an individual field read-only, in design mode, right-click on the form control within the document and select Control from the pop-up menu. Select the General tab and set Read-only to Yes.

[编辑] 窗体控件的格式化 Form control formatting options

设计 模式里,有多种方式来定制窗体的控件的外观和行为。在控件上点击右键,选择快捷菜单的 控件 ,然后选择 属性 对话框中的 常规 选项卡。 You can customize the way form controls look and behave in a number of ways. These are all accessed in Design mode. Right-click on the form control, select Control from the pop-up menu and select the General tab in the Properties dialog box.

  • 标题 字段中填入控件的标题。如按钮和选项按钮等控件会显示标题,但是如文本框等控件则不会显示。 Set a label for the control in the Label field. Some form controls, such as push buttons and option buttons, have visible labels that can be set. Others, such as text boxes, do not.
  • 设置打印文档时是否打印该控件。 Set whether the form control will print out if the document is printed with the Print option.
  • 字体 中设置控件使用的字体和大小,及字体效果。 Use the Font setting to set the font, typeface and size for a field.
  • 您可以设置文本框中的文本的最大长度。当在数据库中增加记录时,该设置就非常重要。因为数据库中的文本字段都有长度限制,当输入的文字过多时,OOo 会显示一条错误信息。把控件的字符长度设置为对应字段的长度就可以避免出现这样的错误。For a text box, you can set the maximum text length. This is very useful when adding records into a database. Every database text field has a maximum length and, if the data entered is too long, OOo displays an error message. By setting the maximum text length of the form control to be the same as that of the database field, this error can be avoided.
  • 可以为控件设置默认值。默认下,控件没有数据,或所有选项都没有选择。您可以为控件设置默认的数据,或者指定某一默认选择。 You can set the default option for a form control. By default, a control is blank, or has every option unselected. You can set the control to start with a particular option or list item selected.
  • 对输入密码的文本框可以指定 密码字符(如 *),那么输入的任何字符将显示为该字符,但输入的实际数据将被记录下来。 For controls where a password is being entered, setting the Password character (for example to *) displays only that character, but saves what the user really types.
  • 您可以为控件增加额外的信息和帮助文字。 You can add additional information and help text for a form control.
  • 还可以设置控件的背景颜色、3-D外观、文字格式、滚动条、边框等。 Other formatting controls such as background color, 3-D look, text formatting, scroll bars and borders allow you to further define how the control appears.

[编辑] 进度表

Writer:高级窗体定制 中文化进度 翻译 0 校对 0 插图 / 上次编辑 20100518150038 编者 Polym

[编辑] 相关链接

本文原文

个人工具