with Statement

Action

Use to nest statements that reference the same window or record data type object. An object reference that starts with a dot ( . ) is understood to refer to the window argument.

Syntax

with window
.statement
Variable Description
window A window.
statement A single statement or a series of statements.

Notes

Use with to make your code easier to read.

Modifications of a record object within a with block do not persist outside the block, because the with statement works with a copy of the record object, rather than with the original record object.

with statements can be nested; however, you can only refer to the innermost window. For example, the following fragment:

with abc
with .def
.ghi 

is equivalent to:

abc.def.ghi

Example 1

The Click and DragMouse methods operate on the same child window:

with MainWin("Draw Prog*").ChildWin("c:\pix\pic2.bmp")
.Click (1, 530, 272)  
.DragMouse (1, 529, 268, 509, 265)

Example 2

abc-window is a common parent of def-window and jkl-window:

with abc-window
.def-window.ghi-method  
.jkl-window.mno-method