Using the Lookup Dialog without the Lookup Control (SmartBusinessEntityLookup)
The following code sample demonstrates the use of the SmartBusinessEntityLookup Dialog class outside of the Context of the Lookup Control.
/********************************************************************** * Copyright (C) 2006-2011 by Consultingwerk Ltd. ("CW") - * * www.consultingwerk.de and other contributors as listed * * below. All Rights Reserved. * * * * Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY * * KIND, either express or implied. * * * * Contributors: * * * **********************************************************************/ /*------------------------------------------------------------------------ File : lookup-dialog.p Purpose : Example demonstrating the use of the SmartBusinessEntityLookupDialog outside of a Lookup control Syntax : Description : Author(s) : Mike Fechner / Consultingwerk Ltd. Created : Thu Aug 04 17:14:16 CEST 2011 Notes : ----------------------------------------------------------------------*/ /* *************************** Definitions ************************** */ ROUTINE-LEVEL ON ERROR UNDO, THROW. USING Consultingwerk.SmartComponents.Support.* . DEFINE VARIABLE oLookupDialog AS SmartBusinessEntityLookupDialog NO-UNDO . DEFINE VARIABLE oResult AS System.Windows.Forms.DialogResult NO-UNDO . /* *************************** Main Block *************************** */ /* Create a new instance of the SmartBusinessEntityLookupDialog, the default constructor does not allow the Lookup Dialog to store user settings like for Dialog position and the column width */ oLookupDialog = NEW SmartBusinessEntityLookupDialog (). ASSIGN oLookupDialog:AdapterType = "" oLookupDialog:LookupSmartBusinessEntityAdapter = ? . oLookupDialog:InitializeDataAdapter() . /* Set the title of the Dialog */ oLookupDialog:SetText ("This is set Lookup Dialog title") . /* Set the usual properties for accessing a BusinessEntity on the backend */ ASSIGN oLookupDialog:AppServerPartition = "" oLookupDialog:LookupBrowserFields = "CustNum,Name,Country" oLookupDialog:LookupDialogQueryString = "FOR EACH eCustomer" oLookupDialog:LookupDialogFilterFields = "CustNum,Name,Country" oLookupDialog:LookupDialogFilterOperators = "GE,BEGINS,BEGINS" oLookupDialog:LookupEntityName = "Consultingwerk.SmartComponentsDemo.OERA.Sports2000.CustomerBusinessEntity" oLookupDialog:LookupEntityTable = "eCustomer" oLookupDialog:LookupEntityView = "" oLookupDialog:LookupKeyField = "CustNum" . /* Show the Dialog, WAIT-FOR Ok or Cancel */ WAIT-FOR oLookupDialog:ShowDialog () SET oResult. /* Compare the DialogResult to Ok, exit when Cancel was pressed */ IF Progress.Util.EnumHelper:AreNotEqual (oResult, System.Windows.Forms.DialogResult:OK) THEN RETURN . /* Access fields from the selected record */ MESSAGE oLookupDialog:GetLookupFieldValue ("CustNum") SKIP oLookupDialog:GetLookupFieldValue ("Name") VIEW-AS ALERT-BOX.