Kbase P35640: How to get a child SDV on a SmartDialog update a parent SDO
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  23/09/2003 |
|
Status: Unverified
GOAL:
How to get a child SDV on a SmartDialog update a parent SDO and its SDV on the main window?
FACT(s) (Environment):
Windows
FACT(s) (Environment):
Progress 9.x
FIX:
1. Start the AppBuilder and connect to the Sports2000 database.
2. Create a SmartDataObject (SDO) against the customer table to include all the fields except comments and save it as dCustomer2000.w.
3. Create a parent SmartDataViewer (SDV) against the Customer SDO dCustomer2000.w to include all the fields except comments and save it as vCustomer2000.w.
4. Create a child SmartDataViewer (SDV) against the Customer SDO to include some of the fields.
5. Place the following code after the "RUN SUPER" statement in a DisplayFields override procedure of the child SmartDataViewer:
DEFINE VARIABLE c AS CHARACTER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE h AS HANDLE NO-UNDO.
c = DYNAMIC-FUNCTION('getFieldHandles':U).
DO i = 1 TO NUM-ENTRIES(c):
h = WIDGET-HANDLE(ENTRY(i, c)).
h:SENSITIVE = TRUE.
END.
6. Save the child SmartDataViewer SDV as vCustomer2000c.w.
7. Open a new SmartDialog and drop the child SDV vCustomer2000c.w on it.
8. In the definition section of the SmartDialog add the code:
DEFINE INPUT PARAMETER h_dcustomer2000 AS HANDLE NO-UNDO.
DEFINE INPUT PARAMETER h_vcustomer2000 AS HANDLE NO-UNDO.
9. Place the following code before the "RUN SUPER" statement in an initializeObject override procedure of the SmartDialog:
RUN addLink
( INPUT h_dcustomer2000,
INPUT "DATA",
INPUT h_vcustomer2000c).
RUN addLink
( INPUT h_vcustomer2000c,
INPUT "Update" ,
INPUT h_dcustomer2000).
10. Modify the code in the Window-Close trigger of the SmartDialog to read:
DO:
DEFINE VARIABLE pcChanges AS CHARACTER NO-UNDO.
DEFINE VARIABLE pcInfo AS CHARACTER NO-UNDO.
RUN collectChanges IN h_vcustomer2000c
( INPUT-OUTPUT pcChanges,
INPUT-OUTPUT pcInfo ).
DYNAMIC-FUNCTION('submitRow':U IN h_dcustomer2000,
INPUT DYNAMIC-FUNCTION('getRowIdent':U IN h_dcustomer2000),
INPUT pcChanges).
DYNAMIC-FUNCTION('fetchRowIdent' IN h_dcustomer2000,
INPUT DYNAMIC-FUNCTION('getRowIdent':U IN h_dcustomer2000),
"").
APPLY "END-ERROR":U TO SELF.
END.
11. Save the SmartDialog as wDialogViewer.w.
12. Open a new SmartWindow and drop the SDO dCustomer2000.w, the SDV vCustomer2000.w, a SmartToolBar and a button widget on it accepting all the suggested default links.
13. In the definition section of the SmartDialog add the code:
DEFINE INPUT PARAMETER h_dcustomer2000 AS HANDLE NO-UNDO.
DEFINE INPUT PARAMETER h_vcustomer2000 AS HANDLE NO-UNDO.
14. Place the following code in the CHOOSE trigger of the button widget:
RUN wDialogViewer.w (h_dCustomer2000, h_vcustomer2000).
15. Save the SmartWindow as wMain.w.
16. Run wMain.w. Click on the Button. Change some fields on the child viewer of the SmartDialog. Close The Smart Dialog. Notice that the changes are saved and are reflected on the parent viewer of the SmartWindow.