R. E. Cook
RunningShoes Library for WinRunner
Custom WinRunner Functions
and Utilities, to Your Specs
A Random Collection of WinRunner Solutions
Creating DLLs for WinRunner
(Mercury Interactive's Worldwide Users Conference 2000)
Header control (SysHeader32) on
a SysListView32 list control.
This technique is useful on a wide variety of other controls.
Microsoft's SysListView32 is a commonly used list box. (It is the file list box
in the right-hand pane of the Windows Explorer, for example.) Each column has
its own header; the user can sort the list by column, by clicking the column
Lack of WinRunner support
Unfortunately, WinRunner doesn't fully support the SysHeader32 control.
WinRunner recognizes the header control as a single object without seeing the
individual headers, which function as push buttons.
Because WinRunner doesn't recognize the individual header for each column, it
records mouse events with the obj_mouse_click() statement, with x and y
coordinates for the click. The coordinates are relative to the header
obj_mouse_click("SysHeader32", 320, 12, LEFT);
Resizing the header control
Users can resize the header control in a number of ways. They can resize the
overall window, vary the width of the individual columns, and in some cases even
change the order and contents of columns.
The problem is, when the control is resized, the obj_mouse_click() statements
fail, because the "buttons" that make up the header control have moved
from their recorded positions.
In this case the solution is easy, because WinRunner does recognize the text
in the headers. Replace the recorded obj_mouse_click() statement with the
obj_click_on_text() statement. WinRunner finds the text label of the individual
header "button" and clicks on that text, so its location is
# Sort the list by filename