python选项卡控件
TheScripts上的一个常见问题是如何设置焦点/激活选项卡控件上的特定选项卡,而不是单击它。 在提供答案之前,我觉得一点点摘要信息将最有帮助。
__1。 选项卡控件上的单个选项卡实际上是页面对象。 但是,在此讨论中,我们将交替使用术语“选项卡/页面”。 __2。 每个页面对象都是页面集合的成员,该集合包括选项卡控件上的所有页面。 __3。 每个页面对象都提供一个控件集合,该控件集合引用特定选项卡/页面上的所有控件。 __4。 既然您已经完全困惑了,那么基本上有5种方法可以引用选项卡控件上的单个选项卡。 我们将使用SetFocus方法演示这一点。 假设: __ 1。 选项卡控件名称:TabCtl1 __2。 标签页数:6 __3。 选项卡/页面标题:Page1,Page2,Page3,Page4,Page5,P a ge6 __4。 标签/页面名称:pgeOne,pgeTwo,pgeThree,pgeFour,pgeFive,pgeSix Method 1:
Me!TabCtl1.Pages(0).SetFocus - set Focus to the 1st Tab Method 2:
Me!TabCtl1.Pages!pgeThree.Setfocus - set Focus to 3rd Tab Method 3:
Me!TabCtl1.Pages("pgeFour").Setfocus - set Focus to 4th Tab Method 4:
Me!TabCtl1.Value = 4 - makes the 5th Tab active Method 5:
SendKeys "%a" - makes the 6th Tab active (a is a 'Hot Key' in the Caption of this Tab.
注意:应该添加或删除选项卡,可能必须修改您的代码才能将焦点设置为适当的选项卡
翻译自: https://bytes.com/topic/access/insights/615446-accessing-tabs-tab-control
python选项卡控件