Referring to objects in your application

You can refer to any object in the application in scripts for menu items. You must fully qualify the reference, using the object name, as follows.

Referring to windows

When referring to a window, you simply name the window. When referring to a property in a window, you must always qualify the property with the window's name:

window.property

For example, this statement moves the window w_cust from within a menu item script:

w_cust.Move(300, 300)

This statement minimizes w_cust:

w_cust.WindowState = Minimized!

You can use the reserved word ParentWindow to refer to the window that the menu is associated with at runtime. For example, the following statement closes the window the menu is associated with:

Close(ParentWindow)

You can also use ParentWindow to refer to properties of the window a menu is associated with, but not to refer to properties of controls or user objects in the window.

For example, the following statement is valid, because it refers to properties of the window itself:

ParentWindow.Height = ParentWindow.Height/2

But the following statement is invalid, because it refers to a control in the window:

ParentWindow.sle_result.Text = "Statement invalid"

Referring to controls and user objects in windows

When referring to a control or user object, you must always qualify the control or user object with the name of the window:

window.control.property
window.userobject.property

For example, this statement enables a CommandButton in window w_cust from a menu item script:

w_cust.cb_print.Enabled = TRUE

Referring to menu items

When referring to a menu item, use this syntax:

menu.menu item
menu.menu item.property

NoteReference within the same menu When referring to a menu item within the same menu, you do not have to qualify the reference with the menu name.

When referring to a menu item in a drop-down or cascading menu, you must specify each menu item on the path to the menu item you are referencing, separating the names with periods.

For example, to place a check mark next to the menu item m_bold, which is on a drop-down menu under m_text in the menu saved in the library as m_menu, use this statement:

m_menu.m_text.m_bold.Check( )

If the previous script is for a menu item in the same menu (m_menu), you do not need to qualify the menu item with the name of the menu:

m_text.m_bold.Check( )