Kbase 15923: How to get a SmartViewer to clear when there is no more data
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/05/1998 |
|
How to get a SmartViewer to clear when there is no more data
INTRODUCTION:
=============
This Knowledgebase entry gives a small code example showing the code
needed in a SmartViewer to make the SmartViewer clear out all of its
fields and disable itself when there are no more records available
in its RECORD-SOURCE and it does not automatically get a notification
that there are no more records.
WHY YOU NEED TO KNOW THIS:
===========================
You may need to know this if you have the following scenario:
SmartBrowse linked to SmartViewer (RECORD-LINK)
SmartPanel linked to SmartViewer (TABLEIO-LINK)
If you hit the DELETE button in the SmartPanel, the SmartViewer
removes the record from the database and sends a notification to other
SmartObjects connected to it. This works fine until the SmartBrowse
has no more records in it. When this happens, the SmartBrowse no
longer sends a row-available message to the SmartViewer so the
SmartViewer never knows to refresh itself with new (or no data).
SAMPLE CODE:
============
Attach the following code to a local-delete-record procedure in the
SmartViewer:
/* Code placed here will execute PRIOR to standard behavior. */
/* Dispatch standard ADM method. */
RUN dispatch IN THIS-PROCEDURE ('delete-record':U).
/* Code placed here will execute AFTER standard behavior. */
DEFINE VARIABLE HDL AS HANDLE NO-UNDO.
DEFINE VARIABLE CH AS CHAR NO-UNDO.
DEFINE VARIABLE IDS AS CHAR NO-UNDO.
RUN get-link-handle IN adm-broker-hdl (THIS-PROCEDURE,
"RECORD-SOURCE":U,
OUTPUT CH).
HDL = WIDGET-HANDLE(CH).
RUN send-records IN HDL ("<TableName>", OUTPUT IDS).
IF IDS = "?" THEN
DO:
CLEAR FRAME {&FRAME-NAME}.
RUN new-state ('no-record-available, SELF':U).
END.
Progress Software Technical Support Note # 15923