FORM.VIEW()

Syntax

<FORM> as P = FORM.VIEW( Form_Name as C [, Style as C [, Window_Name as C [, Horizontal_Position as N [, Vertical_Position as N ]]]] )

Argument

 

Description

Form_Name

V5

The name of the form to open. In the case where there are duplicate form names in the database, you can qualify the form name with the table name using this syntax: Form Name@Table Name. For example, if a database has a form called Customers for the Current_Customers and the Past_Customers tables, you can specify the form as: Customers@Current_Customers, or Customers@Past_Customers.

Style

V5

Optional. Default = "Dialog". Determines the mode of the form.

  • "Popup" = Open the form as a popup window.

  • "Dialog"= Open the form as a modal dialog box.

If a form is opened using the "Popup" style, the following rules apply:

  • Xbasic does not pause, as it does in the case of "Dialog" style.

  • The window can be moved outside of the Alpha Five frame.

  • Alpha Five menus are not active (just like "Dialog" style).

  • The window is not modal. (unlike "Dialog" style).

  • The window is always on top of all other Alpha Five windows.

  • When Alpha Five opens the form it tries to name the window the same as the form name. If a previous instance of the form is already open, then Alpha Five will assign a unique name to the window by adding a digit to the end of the form name. You can explicitly assign the window name by specifying the Window name.

Window_Name

V5

Not applicable.

Horizontal_Position

V5

Optional. Default = "center". The horizontal position of the window. Possible values are:

  • "left"

  • "right"

  • "center"

  • "fill"

V6
  • "pixel_coordinate"

Vertical_Position

V5

Optional. Default = "center". The vertical position of the window. Possible values are:

  • "top"

  • "bottom"

  • "center"

  • "fill"

V6
  • "pixel_coordinate"

Description

Note : The FORM.VIEWQUERIED() method, introduced in Version 5, is more versatile than the FORM.VIEW() method because it allows you to specify an optional filter/order expression to select which records are displayed in the browse window.

Note : It is not required to create an object pointer to reference the new form window. For example the following code fragments show that you can address the form window either by the window name, or by an object pointer.

Note : If you do not close the form at the end of your script, you will leave the underlying table(s) open.

'Using the window name:

:form.view("customers")

:customers.maximize()

'Using the object reference

f = :form.view("customers")

f.maximize()

... do things

f.close()

If you opened a form, but did not assign an object pointer at the time you opened the form, you can still get an object pointer reference to the form using the obj()command. For example:

:form.view("customer")

f = obj(":customer")

... do things

f.close()

To load the form into memory, without displaying it, use the FORM.LOAD() method.

Debugging Aid

When a form loads, any OnInit and OnActivate scripts that are defined for the form execute. This can make debugging an application tricky. By specifying a special keyword for the Style parameter, you can load the form without having the scripts execute. For example:

frm = form.load("customer", "SCRIPT_DISABLE_EXEC")

... do things

frm.close()

Supported By

Alpha Five Version 5 and Above

Limitations

Desktop applications only.

Examples

This script opens the Customer form and then maximizes the form and adds a new record.

:form.view("customer")

:customer.maximize()

:customer.new_record()

:customer:last_name.value = "Smith"

:customer:first_name.value = "John"

:customer.commit()

... do things

:customer.close()

See Also

Using the FORM.VIEW() method, FORM.VIEWQUERIED(), Form Functions and Methods