Kbase 16575: Example: Using set-attribute to pass a list to Smart Objects
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
Example: Using set-attribute to pass a list to Smart Objects
This knowledgebase entry gives example code showing how to use
set-attribute and get-attribute or request-attribute to pass a list
between two smart objects.
In this example, there are 2 Smart Browsers, one for
the customer table, and one for the order table. The order table
browser is a multiple selection browse. The following code shows
what to put in the order browser (b-ord.w) so that on the press of
a button in b-ord.w, a list of selected order-numbers is made
available to other smart objects, with the attribute name o-list.
/* Local Variable Definitions --- */
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE x AS CHARACTER.
DEFINE VARIABLE ll AS LOGICAL.
ON CHOOSE OF BUTTON-1 IN FRAME F-Main /* Button 1 */
DO:
DO i = 1 TO br_table:NUM-SELECTED-ROWS:
ll = br_table:FETCH-SELECTED-ROW(i).
IF x = " " THEN
x = '"' + STRING(order.order-num).
ELSE
x = x + "," + STRING(order.order-num).
END.
x = x + '"'.
RUN set-attribute-list ("o-list = " + x).
MESSAGE x.
END.
Once the b-ord.w Smart Object has done the set-attribute,
other Smart Objects (for example b-cus.w) can access the
list of selected orders. This example shows how a b-cus.w
(which is a Record-Source for the order Smart Viewer)
can access the list of selected orders.
/* Local Variable Definitions */
DEFINE VARIABLE c AS CHARACTER NO-UNDO.
DEFINE VARIABLE o-handle AS HANDLE NO-UNDO.
ON CHOOSE OF BUTTON-1 IN FRAME F-Main /* Button 1 */
DO:
RUN get-link-handle IN adm-broker-hdl
(this-procedure, 'record-target':U, OUTPUT c).
o-handle = WIDGET-HANDLE(c).
/* This example is assuming that the Smart Browser only is
a record-source for only one Smart Object. See the
example under 'get-link-handle' in the User Interface
Builder Developer's Guide to see how to handle multiple
links. */
RUN get-attribute IN o-handle ('o-list').
MESSAGE RETURN-VALUE.
/* This message statement will show the list of selected order
numbers, which can then be used by the smart browser */
END.
An alternate way to do this is 'request-handle' as follows:
ON CHOOSE OF button-1 IN FRAME {&frame-name}
DO:
RUN request-attribute IN adm-broker-hdl
(INPUT THIS-PROCEDURE,
INPUT 'Record-Target':U,
INPUT 'o-list':U) NO-ERROR.
MESSAGE RETURN-VALUE.
END.
Other Sources of Information:
User Interface Builder Developer's Guide, Appendix A.
ADM Reference
Kbase 15487 V8 Using attribute list to pass values between
SmartObjects
Progress Software Technical Support Note # 16575