Kbase P25956: Using the CLIPBOARD with STREAMS
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  27/05/2003 |
|
Status: Unverified
GOAL:
Using the CLIPBOARD with STREAMS
FACT(s) (Environment):
Progress 9.1x
FIX:
An interesting feature is that the clipboard can be the source/target for a stream. It is an elegant way to save a variable list of fields. As an example consider the typical usage of preprocessors in the UIB to create a list of enabled fields. If you wanted to save the data in those fields, perhaps for storage in a general table you could do the following -
---- Code insert begins ----
&SCOPED-DEFINED Search-Fields Name Abbrv Phone
DEFINE STREAM s-clip.
DEF VAR t-data AS CHAR NO-UNDO.
OUTPUT STREAM s-clip TO "clipboard".
/***[ Values have been entered into search fields ]***/
EXPORT STREAM s-clip {&Search-Fields}.
OUTPUT STREAM s-clip CLOSE.
ASSIGN t-data = CLIPBOARD:VALUE.
/***[ t-data could now be saved as a single field ]***/
---- code insert ends ----
The above technique has some limitations in that the clipboard has a size limit and the clipboard is not a safe place if your usage is not atomic enough - since other applications have access to it...
This approach gives you a little flexibility in responding to variations in field lists and assignments. It is not as dynamic as one would like but it does allow for templates to be created that the UIB can help manage. In a custom viewers we use the extra preprocessor lists to identify which fields are to be used for filter and search. The underlying procedures could now save and restore the search criteria to our generic criteria table without code modifications should we decide to toggle a different set of fields on or off.
To reverse the above process just assign t-data into the clipboard and do an import rather than an export.
Overall this feature is neat but probably not very useful.