使用属性窗口来识别窗体上的控件

发布于 2024-11-14 01:01:50 字数 258 浏览 3 评论 0原文

在窗体上选择一个控件后,“属性”窗口的最顶部会显示该控件的名称和类型,并且在下面的下拉菜单中会显示一个包含更多控件的列表。如果我单击其中一个列表项,它会选择表单上的该控件。

1)这个下拉菜单的正确名称是什么?

2) 什么决定哪些控件出现在下拉列表中?

3)如何使任何给定的控件出现在下拉列表中?即在一个非常繁忙的表格上,我知道我在某个地方有一定的控制权,但我看不到它。我想在下拉菜单中选择它,这样它就会知道它的位置,但我不知道如何在该菜单上获取它。

With a control selected on a form, at the very top of the Properties Window the name and type of the control are displayed, and on the dropdown menu underneath there's a list with some more controls. If I click on one of the list items, it selects that control on the form.

1) What is the proper name for this dropdown menu?

2) What determines which controls appear on the dropdown list?

3) How can I make any given control appear on the dropdown list? i.e. on a very busy form, I know I have a certain control on there somewhere but I can't see it. I'd like to select it on the dropdown menu so it will make its location known, but I don't know how to get it on that menu.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泪是无色的血 2024-11-21 01:01:50

我将其称为“属性窗口”下拉菜单。控件似乎以分层/概述的方式显示,尽管并不总是直观的。

例如,我将引用一个带有框架、多页和命令按钮控件的表单,我将其称为“顶级”控件。

控件选择有两种级别:一种是控件以浅色点画为边界,另一种是以深色散列标记为边界。我将第一个称为“激活”,将第二个称为“选择”。您可以通过按 Tab 键或在“属性窗口”下拉列表中选择该控件来“激活”该控件。您可以通过按 Tab 键选择它,然后单击 Enter,或者单击其边框内部来“选择”它。 (如果您通过在属性窗口下拉列表中选择控件来激活该控件,则单击 Enter 将不会选择它。)

当您第一次选择用户窗体时,它将显示在下拉列表中。单击下拉列表时,会列出三个顶级控件。如果您通过在下拉列表中选择多页来激活它,您的下拉选项将不会改变。如果您选择多页(如上所述),则多页当前是活动页面,并且将列出该页面上的控件。 UserForm 本身不会被列出。如果您以相同的方式选择框架,您将得到类似的结果:将列出框架及其顶级控件,而不会列出用户窗体。

我认为导航复杂表单的最佳方法是使用 Tab 键。如果您选择了表单并开始使用选项卡,您将循环浏览所有顶级控件。单击 Enter 将带您“进入”控件。如果该控件有子控件(例如,多页),您可以使用 Tab 键浏览它们。在没有子控件的控件上按 Enter 键将使您进入该控件的编辑模式。例如,在激活命令按钮的情况下按 Enter 键将使您进入字幕编辑模式。

如果您位于具有子控件(例如框架)的“内部”,则可以通过选项卡浏览子控件。一旦您通过选项卡浏览了所有子控件,单击选项卡将使您返回一个级别,例如,将选择命令按钮。

请注意,您还可以通过按 Esc 键“退出”到下一个级别。因此,如果您处于按钮的编辑模式,Esc 将使您返回到仅选择该按钮。如果您选择了框架内的控件,则 Esc 将选择该框架。多次按 Esc 将使您返回到选择表单本身的根级别。

在你的问题促使我进行调查之前,我不知道其中大部分内容,所以感谢您帮助我学习!这是一个令人困惑的话题,所以我希望我的写作能有点清晰。

I'd call it the Property Windows dropdown. It seems the controls are displayed in a hierarchical/outlined manner, although not always an intuitive one.

For example, I’ll refer to a form with a Frame, a Multipage and a Commandbutton control, which I’ll call the “top-level” controls.

There are two levels of control selection: one where the control is bordered by light stipples, and another where it’s bordered by dark hash marks. I call the first “activating” and the second “selecting.” You can “activate” a control by tabbing to it, or by choosing it in the Property Windows dropdown. You can “select” it by tabbing to it and then clicking Enter, or by clicking just inside its border. (If you activate a control by choosing it in the Property Windows dropdown, clicking Enter won’t select it.)

When you first select the Userform it will show in the dropdown. When you click the dropdown list the three top-level controls are listed. If you activate the Multipage by choosing it in the dropdown your dropdown choices won’t change. If you select the Multipage (as described above) the Multipage, it’s currently active Page and the controls on that Page will be listed. The UserForm itself will not be listed. If you select the Frame in the same manner you’ll have similar results: the Frame and its top-level controls will be listed and the UserForm won’t be listed.

I think the best way to navigate a complex form is by tabbing. If you have the form selected and start to tab, you’ll cycle through all the top-level controls. Clicking Enter takes you “into” the control. If that control has sub-controls (e.g., the Multipage) you can then tab through them. Hitting Enter on a control that doesn’t have sub-controls puts you in edit mode for that control. For example, hitting Enter with a Commandbutton activated puts you in caption edit mode.

If you’re “inside” a control with sub-controls, such as the Frame, you can then tab through the sub-controls. Once you’ve tabbed through all the sub-controls, clicking Tab will take you back up a level, e.g., the Commandbutton will be selected.

Note that you can also “back out” to the next level up by hitting the Esc key. So if you’re in edit mode on the button, Esc will take you back to just selecting the button. If you’ve selected a control inside the frame, Esc will select the Frame. Hitting Esc multiple times takes you back to the root level where the form itself is selected.

I didn’t know most of this until your question sparked me to investigate, so thanks for helping me learn! It’s a confusing topic, so I hope my writing is somewhat clear.

卸妝后依然美 2024-11-21 01:01:50

解决OP的项目符号

  1. 属性窗口下拉菜单的正确名称是什么?

    • 对象框

      <块引用>

      对象框列出了当前选定的对象。仅对象来自
      活动形式可见。如果选择多个对象,属性
      对象及其设置的共同点,基于所选的第一个对象,
      显示在“属性列表”选项卡上。
      来源:属性窗口 UI 帮助

    • 或者也许是属性对象框,以区别于代码对象框

      <块引用>

      对象框是位于左上角的列表框
      列出了代码所在的窗体和窗体中的控件的窗口
      已附加,或位于属性窗口顶部的列表框
      列出了表单及其控件。

      来源:VBE 术语表< /a>



  2. 什么决定哪些控件出现在下拉列表中?

    • 回答的方法有很多,但我认为容器是解决你问题的关键;容器是可以容纳其他对象的对象

      <块引用>

      • 如果对象是容器,则对象框将仅列出所选对象及其包含的每个对象;它不会列出任何子容器或容器外部对象的内容
        示例:用户表单、框架和工作表
      • 如果所选对象不是容器,则对象框列出父容器以及父容器内的对象;它不会列出父容器之外的任何子容器或对象的内容
  3. 如何使任何给定的控件出现在下拉列表中?

    • 知道您的容器在哪里以及其中包含什么,我稍后必须重新审视这个答案。没时间了

接受答案的纠正时间点

这是准确的:

  • 如果您通过在“属性窗口”下拉列表中选择一个控件来激活该控件,则单击“Enter”将不会' t 选择它。

是的确实,问题只是焦点问题!

具有焦点的窗口是接收击键的窗口;或者使用答案中的术语,属性窗口必须获得焦点,然后才能“激活”控件和对象窗口 必须先获得焦点,然后才能“选择”活动控件。

  • 解决方案只是将焦点发送到对象
    使用 Shift F7 的窗口
    ,以便它接收击键命令
    选择”活动控件。

处理拥挤的表格

如果你像我一样,那么你已经拆解了比你愿意承认的更多的表格,因为手指的抽动将一个控件埋在了邻居体内的某个地方;很可能是在你花了最后一个小时打磨的复杂巢穴中。

  1. 属性窗口“激活”控件
  2. Shift F7 将焦点设置在对象窗口
  3. Enter “选择”“活动”控件。
    • 如果幸运的话,即使它可能不可见,您也可以用鼠标抓住它。
    • 否则,更改放错位置的控件的Top/Left/Z order可能是找到它的最快方法。您可以按 F4 将焦点置于“属性窗口”,然后按 Ctrl + Shift + T 循环到顶部(或 L 表示左侧

Addressing the OP's Bullets

  1. What is the proper name for Properties window dropdown menu?

    • The Object box

      The Object box lists the currently selected object. Only objects from
      the active form are visible. If you select multiple objects, the properties
      common to the objects and their settings, based on the first object selected,
      appear on the Properties List tabs.
      Source: Properties Window UI Help

    • Or perhaps Properties Object box for differentiation from the Code Object box

      The Object box is the list box at the upper-left corner of the
      window that lists the form and controls in the form to which the code
      is attached, or a list box located at the top of the Properties window
      that lists the form and its controls.

      Source: VBE Glossary

  2. What determines which controls appear on the dropdown list?

    • So many ways to answer but I think containers are the key to your question; containers are objects that can hold other objects
      • If the object is a container then the Object box will only list the selected object and every object it contains; it will not list the contents of any sub-containers or object outside the container
        Example: Userforms, Frames, and Worksheets
      • If the selected object is not a container then the Object box lists the parent container and the objects inside the parent; it will not list the contents of any sub-containers or object outside the parent
  3. How can I make any given control appear on the dropdown list?

    • Knowing where your containers are and what they contain I have to revisit this answer later. Out of time

Point of Correction on the Accepted Answer

This is not accurate:

  • If you activate a control by choosing it in the Property Windows dropdown, clicking Enter won’t select it.

Yes it does, the problem is simply a matter of focus!

The window with focus is the window that receives the keystroke; or to use nomenclature from the answer, the Properties Window must have focus before it can "activate" a control and the Object Window must have focus before the active control can be "selected".

  • The solution is simply a matter of sending focus to the Object
    Window
    with Shift F7 so that it receives the keystroke command
    to "select" the active control.

Coping with Crowded Forms

If you are like me, then you have disassembled more forms than you care to admit because a finger twitch buried a control somewhere inside a neighbor; likely in complex nest that you spent the last hour polishing.

  1. "Activate" the control from the Properties Window
  2. Press Shift F7 to set focus on the Object Window
  3. Press Enter to "select" the "active" control.
    • If you are lucky then you will be able to grab it with the mouse even though it may not be visible.
    • Otherwise, changing the misplaced control's Top/Left/Z order may be the fastest way to find it. You can press F4 to set focus on the Properties Window and Ctrl + Shift + T to cycle to Top(or L for Left)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文