Progress
ADM 2 Guide
SmartSelect Usage Notes
This section discusses special programming considerations for using SmartSelects.
Event on Change Instance Property
The Event on change property allows you to specify an event to PUBLISH if the value of a displayed SmartSelect field changes. However, doing this entails more than simply specifying an event name; you must also subscribe the SmartSelect’s data source to your new event, define the event, and so forth. The following example illustrates how to do this. Note that it assumes that you have started the AppBuilder and connected to a copy of the Progress sports2000 database. Follow these steps:
- Create the following SmartObjects:
- Drop the salesrep SmartDataObject onto the SmartDataViewer.
- Drop a SmartSelect onto the salesrep field of the SmartDataViewer.
- Set the SmartSelect instance properties as follows:
- SmartDataObject: dslsrep.w (the salesrep SmartDataObject)
- Key Field: SalesRep
- Displayed Field: SalesRep
- Event on change: SalesRepSelected (you will define this event in a later step)
- View as: Browser
- Label: Sales Rep
- Browse Title: Sales Representatives
- Tooltip: Select Sales Rep for the Order
For all other instance properties, accept the defaults.
- In the Section Editor, create the following:
- An override procedure for the SmartDataViewer that uses the initializeObject procedure. Note that whether this procedure runs before or after the SmartDataViewer’s standard behavior depends on where you put the code, as the example code illustrates.
- A SUBSCRIBE statement for your event. (Note that h_dynselect is the SmartSelect object name.)
- Using the Section Editor, create an internal procedure that defines your event; for example:
- Save this procedure with Name = SalesRepSelected.
- Save the SmartDataViewer object as
vcustsls.w
.- Create a new SmartWindow, then add the following:
- Save this application as the object
wcustsls.w
, then run it.- Choose Browse icon to view a list of sales-representative names.
- Select the name of a sales representative. A dialog box appears and displays the value that you selected. This dialog box is based on the SalesRepSelected procedure that you defined.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |