How to Call a Lookup Dialog

Previous Next

See Also

Lookup windows are called from query columns that are defined as a foreign key in a relationship.

Lookup dialogs can be called from inserted controls like text boxes, both from windows and from dialogs. This is especially useful when creating lookup functionality in dialogs, as in this example.

To call a lookup dialog from a dialog field:

1. Use the Windows Designer to create and design the dialog class.
2. For the control where you want the lookup button, typically, a text box, set the Related Column property to:


using capitals, e.g.:


3. Select the Lookup Method property on the Behavior tab page, and click the Edit button to open the Object Activator for this property.
4. In the Object Browser pane, select the display control for the text box where you want the lookup button, for example:


The reason you need to do this is that the WindowCreateLookupDialog method is exposed by the column display control, not by the window as a whole.

5. In the Methods list, select the WindowCreateLookupDialog method, and click Add.
6. Select the subnode in the Script box, click Edit, and type the name of the lookup dialog class you want to call. This must be a subclass of the Lookup Dialog class.

The method call now looks like this:

Variables.Text_Box_1.TextBox.WindowCreateLookupDialog(<Lookup Dialog class name>)

7. Click OK to accept.

The lookup window does not support function keys such as F2 and F3, but it will take on the icon toolbar from the Lookup Dialog style sheet class.

For ease of design and maintenance, start by creating a special lookup dialog subclass.