Kbase 18942: VALUE-CHANGED / SCREEN-VALUE of SmartDataBrowser (ADM 2)
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  19/05/2000 |
|
Summary:
--------
In version 8 SmartBrowser customers could use a code that referenced
fields of a currently higlighted row similar to:
ON VALUE-CHANGED OF br_table DO:
MESSAGE customer.name.
END.
This code results in a message - No customer record is available. (91)
when code is executed and the same happens if code is modified to use
RowObject instead of the customer table.
PROCEDURAL APPROACH:
====================
Much of the idea of having "thin" visual objects is that data values
exist only as screen-values in the SDBrowse or SDViewer frame. There
is no underlying record buffer present. This frees the visual objects
from a tighter coupling to the data objects than is necessary. For
example, a SDViewer, though it is initially built against particular
SDO, can be run against any SDO that can supply the field names it
needs, regardless of actual buffer definitions. The same is not true
for SDBrowsers, which need to browse the SDO query directly.
Also, this facilitates attaching an SDO to some non-Progress
visualization such as a grid control which would have no way of
dealing with a buffer parameter.
The down side to this is that when you want to write custom code to
refer to fields in the visualization.
Bellow are two examples to get the values:
1) Get query, buffer and field handles
/* DEFINITIONS */
DEFINE VARIABLE hQ AS HANDLE NO-UNDO.
DEFINE VARIABLE hB AS HANDLE NO-UNDO.
DEFINE VARIABLE hF AS HANDLE NO-UNDO.
/* initializeObject */
...
RUN SUPER.
ASSIGN hQ = {&BROWSE-NAME}:QUERY IN FRAME {&FRAME-NAME}
hB = hQ:GET-BUFFER-HANDLE(1)
hF = hB:BUFFER-FIELD("name").
/* VALUE-CHANGED trigger */
{src/adm2/brschnge.i}
MESSAGE hf:STRING-VALUE.
2) Put the following into VALUE-CHANGED trigger:
DEFINE VARIABLE h AS HANDLE NO-UNDO.
{src/adm2/brschnge.i}
ASSIGN h = DYNAMIC-FUNCTION('getdataSource').
MESSAGE
/* one fields string-value */
DYNAMIC-FUNCTION('columnStringValue' IN h, 'name') SKIP
/* db rowid(s) */
DYNAMIC-FUNCTION('getRowident' IN h) SKIP
/* rowobj-rowid, db-rowid(s), specified fields string-value with
delimiters (see doc) */
DYNAMIC-FUNCTION('colValues' IN h, 'custnum,name') SKIP.
(VZA 21-Jun-1999)
(VZA 19-May-2000)