Kbase 20253: Steps you must take in order to make the Progress SmartSelect instance property "Event on change" wo
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/07/2008 |
|
Status: Unverified
GOAL:
Steps you must take in order to make the Progress SmartSelect instance property "Event on change" work.
GOAL:
How to make a SmartSelect instance "Even on Change"?
FACT(s) (Environment):
Progress 9.x
FIX:
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 setable 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". This can be achieved in two ways:
A) 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.
Or...
B) Create a smartLink with these characteristics:
Source: the smartSelect you supplied with "Event on Change"
Link Type: the name of the "Event on Change", in this example slsRepChanged. This won't be available in the default smartLinks so you have to create using "New"
Target: THIS-PROCEDURE
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.