Specifying a Window

Description

You can specify which window you want to operate on in one of two ways:

  • You can specify the window by its name, or

  • You can specify a pointer that references the window (the preferred method).

Specifying by Name 

When you open a form or browse layout, the window name is generally the same as the form or browse name (with two exceptions, described below). You may have opened more than one instance of the form or browse layout. Since a window name must be unique, Alpha Anywhere automatically appends a number to the layout name to differentiate the second and subsequent instances of that layout. For example, if you have a form called CustomerList, which is opened twice, the first window will be called CustomerList and the second window may be called CustomerList0. The Xbasic command to open a window allows you to specify the unique window name associated with the window. So, there is no guarantee that the window name for the CustomerList form is indeed CustomerList. Since it is hard to know with certainty what the window name is, the preferred method for specifying the Window is to specify a pointer.

Specifying a Pointer 

When a form or browse window is opened, you can optionally associate a pointer variable with the window that is opened. This pointer allows you to uniquely identify the window when you want to perform some action on the window (such as Closing, or hiding it) or on one of the objects contained within the window (such as entering a value into one of the controls on a form). For example, the following Xbasic commands opens the CustomerList form, and creates a pointer called p1 that allows you to reference the window:

dim p1 as P
p1 = form.view("CustomerList")

To close this window, you could use the Xbasic command:

P1.close()

See Also