Kbase P73807: ADM2. How to make the Progress SmartSelect instance property Event on change work
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  26/10/2004 |
|
Status: Unverified
GOAL:
ADM2. How to make the Progress SmartSelect instance property "Event on change" work
FACT(s) (Environment):
Progress 9.1x
FIX:
This solution describes the steps you must take in order to make the Progress SmartSelect instance property "Event on change" work.
As an example, assume you have built a SmartDataViewer for the Customer table. On this SmartDataViewer, you have replaced the Customer.SalesRep field with a SmartSelect object that is connected to a SmartDataObject for the SalesRep table (Data-Source). Assume you have placed an instance of this SalesRep SmartDataObject on the SmartDataViewer.
Follow these steps to make Event on change work:
1) Right mouse-click on the SmartSelect object.
2) Choose Instance Properties.
A dialog-box with settable attributes for the SmartSelect object appears. In the Data group there is a still empty fill-in with the label Event on Change. In this fill-in you can enter a name of an event that will be published when the value of the SmartSelect object instance in the SmartDataViewer changes at runtime.
3) Label the fill-in "slsRepChanged".
4) Close the dialog-box by pressing the OK button.
Next, two things must be defined in the Customer SmartDataViewer master:
1) An internal procedure with the same name as the name you supplied at the Event on Change in the SmartSelect object (slsRepChanged).
You must define an input parameter in this internal procedure (for this example, call it "cPassedValue").
The input parameter holds the changed value of the key field you specified in the SmartSelect's data group on the instance properties dialog-box.
At this point you can program some code that does some things based upon this passed in parameter. For instance, insert the following line of code:
MESSAGE 'New value is: ' cPassedValue.
2) Subscribe to the named event "slsRepChanged" in an override procedure initializeObject so that the SmartDataViewer can respond to the named event whenever the SmartSelect object publishes it.
After the "RUN SUPER", code the following line:
SUBSCRIBE TO 'slsRepChanged' IN h_dynselect.
When you use the SmartDataViewer in a SmartWindow connected to a Customer SmartDataObject, you should now see the message with the new value pop up whenever you change the content of the Salesrep field.