white学习3(官方网站的内容)
2011-04-26 13:59
302 查看
Performing special operations on a window
Attached Keyboard and mouse
provides a keyboard or mouse which would wait for the window to be idle after every action. All the actions possible on the mouse and keyboard are supported by these.
Tooltip
any window, including it child controls can have only one visible tooltip at a time, hence this method is available on the window object.
string message = window.ToolTip;
In some applications the tool tip is associated to an error provider which looks like
. When mouse is hovered on it, a message is shown as tooltip. This need not be implemented by user as it is pretty standard behaviour and white provides it out of the box. If the message is set on the error provider for ComboBox then:
var comboBox = window.Get<ComboBox>("komboBox");
string message = comboBox.ErrorProviderMessage(window);
Closing the window
Window object implements IDisposable interface, so that it can be used with the using block. Also, dispose is same as close. One can also check whether a window was closed or not. When a window.Close() is called white would try to close it using the WindowPattern provided by UIAutomation. In case this pattern is not implemented then white would make use of the close in the title bar to close it.
window.Close(); //by default it waits while the window is busy.
bool isClosed = window.IsClosed; //isClosed would be true
Tool bar
Typical a window has zero or one tool bar. But it is possible to have more than one present on a window. Most likely scenario works as a special case of generic scenario in white.
ToolStrip toolStrip1 = window.GetToolStrip("toolStripId1");
// if there is only one then one can also do following to achieve the same
toolStrip1 = window.ToolStrip;
//ToolStrip is a UIItemContainer so child items can be found from it by call get methods.
Button button = toolStrip1.Get<Button>("toolButton");
WaitWhileBusy
It makes the window wait till the user input cannot be provided as it is busy performing background tasks. This method need not be called as all operations on UIItems explicitly call this at the end of every action. This method wouldn't cause wait indicated as hour glass, since this is controlled by application. But this is taken care of explicitly inside white but is not exposed to the user. Waiting based on hour glass is the default approach which can be turned off. (Configuration)
Menu
A window can contain multiple menu bars. White supports working with multiple and since having single menu bar is so common it provides a convenience method for it.
List<MenuBar> menuBars = window.MenuBars;
MenuBar menuBar = window.MenuBar; //use it to get the only menu bar.
Display state
A window can be in three display states: maximize, minimized and restored.DisplayState property on window provides this. Core.UIItems.WindowItems.DisplayState enum can be used to specify the state to a window.
Whether or not a window is the top most window at time can be retrieved by IsCurrentlyActive property.
Attached Keyboard and mouse
provides a keyboard or mouse which would wait for the window to be idle after every action. All the actions possible on the mouse and keyboard are supported by these.
Tooltip
any window, including it child controls can have only one visible tooltip at a time, hence this method is available on the window object.
string message = window.ToolTip;
In some applications the tool tip is associated to an error provider which looks like
. When mouse is hovered on it, a message is shown as tooltip. This need not be implemented by user as it is pretty standard behaviour and white provides it out of the box. If the message is set on the error provider for ComboBox then:
var comboBox = window.Get<ComboBox>("komboBox");
string message = comboBox.ErrorProviderMessage(window);
Closing the window
Window object implements IDisposable interface, so that it can be used with the using block. Also, dispose is same as close. One can also check whether a window was closed or not. When a window.Close() is called white would try to close it using the WindowPattern provided by UIAutomation. In case this pattern is not implemented then white would make use of the close in the title bar to close it.
window.Close(); //by default it waits while the window is busy.
bool isClosed = window.IsClosed; //isClosed would be true
Tool bar
Typical a window has zero or one tool bar. But it is possible to have more than one present on a window. Most likely scenario works as a special case of generic scenario in white.
ToolStrip toolStrip1 = window.GetToolStrip("toolStripId1");
// if there is only one then one can also do following to achieve the same
toolStrip1 = window.ToolStrip;
//ToolStrip is a UIItemContainer so child items can be found from it by call get methods.
Button button = toolStrip1.Get<Button>("toolButton");
WaitWhileBusy
It makes the window wait till the user input cannot be provided as it is busy performing background tasks. This method need not be called as all operations on UIItems explicitly call this at the end of every action. This method wouldn't cause wait indicated as hour glass, since this is controlled by application. But this is taken care of explicitly inside white but is not exposed to the user. Waiting based on hour glass is the default approach which can be turned off. (Configuration)
Menu
A window can contain multiple menu bars. White supports working with multiple and since having single menu bar is so common it provides a convenience method for it.
List<MenuBar> menuBars = window.MenuBars;
MenuBar menuBar = window.MenuBar; //use it to get the only menu bar.
Display state
A window can be in three display states: maximize, minimized and restored.DisplayState property on window provides this. Core.UIItems.WindowItems.DisplayState enum can be used to specify the state to a window.
Whether or not a window is the top most window at time can be retrieved by IsCurrentlyActive property.
相关文章推荐
- white学习14(官方网站的内容)
- white学习2(官方网站的内容)
- white学习15(官方网站的内容)
- white学习4(官方网站的内容)
- white学习5(官方网站的内容)
- white学习6(官方网站的内容)
- white学习7(官方网站的内容)
- white学习8(官方网站的内容)
- white学习9(官方网站的内容)
- white学习16(官方网站的内容)
- white学习10(官方网站的内容)
- white学习10(官方网站的内容)
- white学习13(官方网站的内容),介绍White.NUnit
- white学习12(官方网站的内容),介绍一个捕获元素工具UISpy
- 参考TinyOS官方网站学习建立新platform-yamp
- TensorFlow 中文资源精选,官方网站,安装教程,入门教程,实战项目,学习路径
- [Groovy] 学习Groovy的好网站(内容全面)
- 廖雪峰官方网站python学习笔记:第一个Pyhon程序
- 参考TinyOS官方网站学习基于printf库的打印调试
- 学习笔记 - EasyUI官方网站演示