Kbase P115262: ADM2: How to and AutoAdd functionality after tabbing from the last field of a SmartDataViewer ( SDV
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  20/03/2008 |
|
Status: Verified
GOAL:
ADM2: How to and AutoAdd functionality after tabbing from the last field of a SmartDataViewer ( SDV ) or a SmartDataBrowser ( SDB )?
GOAL:
How to programmatically save and create after tabbing from the last field of a SmartDataBrowser
GOAL:
How to Add and Save records without using the SmartToolBar
FACT(s) (Environment):
Windows
Progress 9.x
OpenEdge 10.x
FIX:
The following sample SmartWindow demonstrates one way to allow the continuos addition of records. In this specific sample, when the user tabs out of the last field in the OrderLine SmartDataBrowse (SDB), the user enters the ADD RECORD mode automatically without having to to click SAVE RECORD and then ADD RECORD from the SmartToolBar.
This example has a SmartWindow with the following objects on it:
1 SDO based on the Order table
1 SDO based on the OrderLine table
1 SDB with default links to the Order table
1 SDB updateable with default links to the OrderLine table
1 SmartToolBar with default links to the OrderLine SDB
To program the 'AutoAdd' functionality:
1. Define a logical variable in the SmartDataBrowser object to trap whether the user TABed from the last field in the SDB:
DEFINE VARIABLE lTab AS LOGICAL INIT FALSE NO-UNDO.
2. Create an ON TAB trigger for the last field in the browse with
the following line of code:
lTab = True.
3. Override the updateRecord procedure of the SmartDataBrowser and
add the following:
RUN SUPER.
IF lTab THEN DO:
RUN addRecord.
lTab = FALSE.
END.