SysTableLookup can be used in dialogs to create custom
lookups.
control.registerOverrideMethod can be used to register the
methods to override by an object
Here is the example which shows basic usage of both. We will
create a dialog and get a lookup of account numbers on a control
protected Object dialog()
{
FormStringControl
control;
;
dialog = super();
dialogFeildAccountNum = dialog.addField(extendedTypeStr(AccountNum));
control =
dialogFeildAccountNum.control();
control.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(DialogLookup,
accountNumLookup),
this);
return dialog;
}
Here is the method:
private void
accountNumLookup(FormStringControl _control)
{
SysTableLookup sysTableLookup;
QueryBuildDataSource queryBuildDataSource;
Query query = new Query();
queryBuildDataSource = query.addDataSource(tablenum(CustTable));
sysTableLookup =
SysTableLookup::newParameters(tablenum(CustTable), _control);
sysTableLookup.addLookupfield(fieldnum(CustTable,
AccountNum), true);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}