开发者

Using the Properties Window to identify controls on a form

With a control selected on a form, at the very top of the Properties Window the name and type of the control are d开发者_如何学JAVAisplayed, 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.


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.


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜