Form S_200FC
*===================================================================;
*;
* Component : S_200FC;
* Type : Form;
* Ancestor : PRIM_FORM (Primitive Form);
*;
* Description : Investigate the memo box in more detail;
*;
* Disclaimer : The following material is supplied as sample material;
* only. No warranty concerning this material or its use;
* in any way whatsoever is expressed or implied.;
*;
* ===================================================================;
;
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM FORMPOSITION(ScreenCenter) HEIGHT(550) LEFT(296) TOP(117) VISUALSTYLE(#VS_NORM) WIDTH(860);
DEFINE_COM CLASS(#PRIM_MEMO) NAME(#MEMO_1) ADDENTRYMODE(MultiplePerLine) CURRENTLINE(1) DISPLAYPOSITION(1) HEIGHT(153) LEFT(8) MAXIMUMLINELENGTH(10000) PARENT(#COM_OWNER) POPUPMENU(#PMNU_1) TABPOSITION(1) TOP(48) WIDTH(200) WORDWRAP(True);
DEFINE_COM CLASS(#PRIM_MECL) NAME(#MECL_1) COLUMNROLE(Data) DISPLAYPOSITION(1) PARENT(#MEMO_1) SOURCE(#S_LINETXT) WIDTH(20);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_CUT) CAPTION('Cut') DISPLAYPOSITION(2) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(2) TOP(208) WIDTH(49);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_COPY) CAPTION('Copy') DISPLAYPOSITION(3) LEFT(72) PARENT(#COM_OWNER) TABPOSITION(3) TOP(208) WIDTH(49);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_PASTE) CAPTION('Paste') DISPLAYPOSITION(4) LEFT(136) PARENT(#COM_OWNER) TABPOSITION(4) TOP(208) WIDTH(49);
DEFINE_COM CLASS(#PRIM_LTVW) NAME(#LTVW_1) DISPLAYPOSITION(5) FULLROWSELECT(True) HEIGHT(201) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(5) TOP(312) VISUALSTYLE(#VS_FIXED) WIDTH(833);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_DISP) CAPTION('Display contents of memo box in list') DISPLAYPOSITION(6) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(6) TOP(264) WIDTH(201);
DEFINE_COM CLASS(#PRIM_MECL) NAME(#MECL_2) COLUMNROLE(LineNumber) DISPLAYPOSITION(2) PARENT(#MEMO_1) SOURCE(#S_LINENO) WIDTH(20);
DEFINE_COM CLASS(#PRIM_MECL) NAME(#MECL_3) COLUMNROLE(LineContinuation) DISPLAYPOSITION(3) PARENT(#MEMO_1) SOURCE(#S_LINECTN) WIDTH(20);
DEFINE_COM CLASS(#PRIM_LVCL) NAME(#LVCL_1) CAPTION('Line') CAPTIONTYPE(Caption) DISPLAYPOSITION(1) PARENT(#LTVW_1) SOURCE(#S_LINENO) WIDTH(8);
DEFINE_COM CLASS(#PRIM_LVCL) NAME(#LVCL_2) CAPTION('Continuation') CAPTIONTYPE(Caption) DISPLAYPOSITION(2) PARENT(#LTVW_1) SOURCE(#S_LINECTN) WIDTH(12);
DEFINE_COM CLASS(#PRIM_LVCL) NAME(#LVCL_3) DISPLAYPOSITION(3) PARENT(#LTVW_1) SOURCE(#S_LINETXT) WIDTH(20) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_1) CAPTION('Save Memo box as') DISPLAYPOSITION(1) HEIGHT(76) LAYOUTMANAGER(#FWLM_1) LEFT(8) PARENT(#GPBX_2) TABPOSITION(1) TABSTOP(False) TOP(15) WIDTH(217);
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_SVDB) BUTTONCHECKED(True) CAPTION('database records in file S200NTE') DISPLAYPOSITION(1) LEFT(13) PARENT(#GPBX_1) TABPOSITION(1) TOP(30) WIDTH(190);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_1) DIRECTION(TopToBottom) FLOWOPERATION(Center) FLOWOPERATIONVER(Spread);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_2) MANAGE(#RDBN_SVDB) PARENT(#FWLM_1);
DEFINE_COM CLASS(#S_200ID.Visual) NAME(#S_200ID) CAPTION('Use this text to identify your note when loading and saving from the database') DISPLAYPOSITION(7) HEIGHT(19) LABELTYPE(Caption) LEFT(8) MARGINLEFT(400) PARENT(#COM_OWNER) TABPOSITION(7) TOP(14) WIDTH(693);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_SAVE) CAPTION('Save Memo Box') DISPLAYPOSITION(2) LEFT(8) PARENT(#GPBX_2) TABPOSITION(2) TOP(104) WIDTH(217);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_2) DISPLAYPOSITION(8) HEIGHT(137) LAYOUTMANAGER(#FWLM_2) LEFT(232) PARENT(#COM_OWNER) TABPOSITION(8) TABSTOP(False) TOP(48) WIDTH(233);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_2) DIRECTION(TopToBottom) FLOWOPERATION(Center) FLOWOPERATIONVER(Spread);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_3) MANAGE(#GPBX_1) PARENT(#FWLM_2);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_4) MANAGE(#PHBN_SAVE) PARENT(#FWLM_2);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_3) DISPLAYPOSITION(9) HEIGHT(137) LAYOUTMANAGER(#FWLM_4) LEFT(472) PARENT(#COM_OWNER) TABPOSITION(9) TABSTOP(False) TOP(48) WIDTH(233);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_4) CAPTION('Load Memo box from') DISPLAYPOSITION(1) HEIGHT(81) LAYOUTMANAGER(#FWLM_3) PARENT(#GPBX_3) TABPOSITION(1) TABSTOP(False) TOP(13) WIDTH(212);
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_LDPG) CAPTION('simulated text stream') DISPLAYPOSITION(1) LEFT(30) PARENT(#GPBX_4) TABPOSITION(1) TOP(14) WIDTH(151);
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_LDDB) CAPTION('database file S200NTE') DISPLAYPOSITION(2) LEFT(30) PARENT(#GPBX_4) TABPOSITION(2) TOP(50) WIDTH(151);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_3) DIRECTION(TopToBottom) FLOWOPERATION(Center) FLOWOPERATIONVER(Spread);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_5) MANAGE(#RDBN_LDPG) PARENT(#FWLM_3);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_6) MANAGE(#RDBN_LDDB) PARENT(#FWLM_3);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_LOAD) CAPTION('Load Memo box') DISPLAYPOSITION(2) PARENT(#GPBX_3) TABPOSITION(2) TOP(106) WIDTH(208);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_4) DIRECTION(TopToBottom) FLOWOPERATION(Center) FLOWOPERATIONVER(Spread);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_8) MANAGE(#GPBX_4) PARENT(#FWLM_4);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_9) MANAGE(#PHBN_LOAD) PARENT(#FWLM_4);
DEFINE_COM CLASS(#PRIM_PMNU) NAME(#PMNU_1);
DEFINE_COM CLASS(#PRIM_MITM) NAME(#MITM_CUT) CAPTION('Cut') DISPLAYPOSITION(1) PARENT(#PMNU_1);
DEFINE_COM CLASS(#PRIM_MITM) NAME(#MITM_COPY) CAPTION('Copy') DISPLAYPOSITION(2) PARENT(#PMNU_1);
DEFINE_COM CLASS(#PRIM_MITM) NAME(#MITM_PASTE) CAPTION('Paste') DISPLAYPOSITION(3) PARENT(#PMNU_1);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_1) DISPLAYPOSITION(10) HEIGHT(113) LAYOUTMANAGER(#ATLM_1) LEFT(232) PARENT(#COM_OWNER) TABPOSITION(10) TABSTOP(False) TOP(192) VISUALSTYLE(#VS_PANEL) WIDTH(473);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_1);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('This example demonstrates how text can be loaded into a memo box from a text stream or other data source and then edited and saved as a note to a database file. As long as the text stream has been processed once, before loading into the memo box for the first time, subsequent loads and saves of the memo text from/to the database require no special processing.') DISPLAYPOSITION(1) HEIGHT(72) LEFT(0) PARENT(#PANL_1) TABPOSITION(1) TABSTOP(False) TOP(0) WIDTH(469);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_1) ATTACHMENT(Center) MANAGE(#LABL_1) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_2) CAPTION('The list view below shows how the memo text is stored. Note how entries that end with a blank have had another blank automatically added to the beginning of the next entry.') DISPLAYPOSITION(2) HEIGHT(37) LEFT(0) PARENT(#PANL_1) TABPOSITION(2) TABSTOP(False) TOP(72) WIDTH(469);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_2) ATTACHMENT(Bottom) MANAGE(#LABL_2) PARENT(#ATLM_1);
;
;
GROUP_BY NAME(#S_GRPNTE) FIELDS(#S_200ID #S_LINENO #S_LINECTN #S_LINETXT);
DEFINE #S_200NLIN reffld(#S_LINENO) desc('New line number');
DEFINE #S_200PLIN reffld(#S_LINENO) desc('Previous line number');
DEFINE #S_200NCTN reffld(#S_LINECTN) desc('New continuation number');
DEFINE #S_200NTXT reffld(#S_LINETXT) desc('New text');
;
;
EVTROUTINE handling(#com_owner.Initialize);
SET #com_owner caption(*component_desc);
;
set (#RDBN_LDPG #RDBN_SVDB) ButtonChecked(TRUE);
;
execute LDPGM;
execute LD_LSTVW;
;
ENDROUTINE;
;
*;
* initialise in preparation for writing to a multi-line memo edit box;
*;
subroutine STARTMEMO;
clr_list #MEMO_1;
* note that the character position must be reset for new memos;
set #MEMO_1 CharacterPosition(0);
clr_list #S_LSTLINE;
CHANGE #S_200PLIN 0;
endroutine;
;
EVTROUTINE HANDLING(#PHBN_CUT.Click #MITM_CUT.Click);
invoke #MEMO_1.Cut;
ENDROUTINE;
EVTROUTINE HANDLING(#PHBN_COPY.Click #MITM_COPY.Click);
invoke #MEMO_1.Copy;
ENDROUTINE;
EVTROUTINE HANDLING(#PHBN_PASTE.Click #MITM_PASTE.Click);
invoke #MEMO_1.Paste;
ENDROUTINE;
;
*;
* Show the contents of the memo box in a list view;
*;
EVTROUTINE HANDLING(#PHBN_DISP.Click);
execute LD_LSTVW;
endroutine;
subroutine LD_LSTVW;
CLR_LIST #LTVW_1;
SELECTLIST #MEMO_1;
ADD_ENTRY #LTVW_1;
endselect;
ENDROUTINE;
;
*;
* Save the note to file;
*;
EVTROUTINE HANDLING(#PHBN_SAVE.Click);
* Note how no special handling is required;
IF '#RDBN_SVDB.ButtonChecked *eq TRUE';
DELETE S200NTE with_key(#S_200ID);
SELECTLIST #MEMO_1;
INSERT #S_GRPNTE S200NTE;
ENDSELECT;
ENDIF;
ENDROUTINE;
;
*;
* Load the memo box, either using program generated text stream, or from file;
*;
EVTROUTINE HANDLING(#PHBN_LOAD.Click);
IF '#RDBN_LDPG.ButtonChecked *eq TRUE';
* demonstrate loading a text stream to a multiline memo edit box;
execute LDPGM;
endif;
IF '#RDBN_LDDB.ButtonChecked *eq TRUE';
* an ordinary load of memo box data into a memo box;
* Note how no special handling is required.;
EXECUTE STARTMEMO;
;
SELECT #S_GRPNTE S200NTE with_key(#S_200ID);
* database note info has already been processed for trailing spaces;
* (either the text-stream load processed the trailing spaces;
* or the text was originally entered via the multi-line edit box which automatically adds a leading space to the;
* next line whenever it encounters a trailing space);
* hence the note info can be added directly.;
;
ADD_ENTRY #MEMO_1;
ENDSELECT;
endif;
;
ENDROUTINE;
;
;
;
* ==========================================================================================;
*;
* Logic for adding a text stream to a multiline memo edit box;
*;
* ==========================================================================================;
;
;
*;
* Generate some example text for the memo box;
*;
Subroutine LDPGM;
* Note #S_LINETXT is 75 characters, and each value except the last one should be exactly 75 characters;
* This simulates a text stream, arriving as a series of blocks of equal length.;
;
* Leading spaces are handled without additional processing, but trailing spaces are lost.;
* Therefore trailing spaces must be converted into leading spaces on the next entry.;
CHANGE #S_200ID '''PROGRAM GENERATED''';
;
* Start writing to a multi-line memo edit box;
EXECUTE STARTMEMO;
;
CHANGE #S_LINENO 1;
;
CHANGE #S_LINECTN 1;
* note: trailing space at the end of an entry (special handling required);
CHANGE #S_LINETXT '''The following long and tedious piece of text did not originate from a memo ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
CHANGE #S_LINETXT '''box and has been programmatically loaded into the memo box. It demonstrates''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 3;
* note: leading space (no special handling required);
* note: trailing spaces at the end of the last entry of a line (no special handling required);
CHANGE #S_LINETXT ''' that trailing blanks in a block require special handling.''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
*new line;
CHANGE #S_LINENO 2;
;
CHANGE #S_LINECTN 1;
CHANGE #S_LINETXT '''*************************''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
*new line;
CHANGE #S_LINENO 3;
;
CHANGE #S_LINECTN 1;
* note: trailing space (special handling required);
CHANGE #S_LINETXT '''The value for a data field for an item is held in one of two fields on the ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
* note: trailing space (special handling required);
CHANGE #S_LINETXT '''item data field record, according to whether the data field is defined as ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 3;
CHANGE #S_LINETXT '''alpha or numeric. This presents various problems if the XDB administrator c''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 4;
CHANGE #S_LINETXT '''hanges the definition of the data field from alpha to numeric: The action i''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 5;
CHANGE #S_LINETXT '''nitiated from the front end needs to be capable of being performed in two p''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 6;
CHANGE #S_LINETXT '''arts, firstly a validation pass that makes sure that all of the existing va''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 7;
CHANGE #S_LINETXT '''lues conform to the new definition, and then secondly, if valid, a pass thr''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 8;
CHANGE #S_LINETXT '''ough the data that actually performs the move of the values, from one field''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 9;
* note: leading space (no special handling required);
* note trailing spaces for the last entry of a line (no special handling required);
CHANGE #S_LINETXT ''' to the other.''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
* new line (hard return detected);
CHANGE #S_LINENO 4;
;
CHANGE #S_LINECTN 1;
CHANGE #S_LINETXT '''While the change is taking place (a matter of some seconds), the users must''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
* note: leading space (no special handling required);
CHANGE #S_LINETXT ''' not be allowed to update the value for this data field for an item. Even a''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 3;
CHANGE #S_LINETXT '''ttempting merely to view the item data field could cause the system to give''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 4;
* note: leading space (no special handling required);
* note trailing spaces for the last entry of a line (no special handling required);
CHANGE #S_LINETXT ''' unpredictable results.''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
* new line (hard return detected);
CHANGE #S_LINENO 5;
;
CHANGE #S_LINECTN 1;
* note: trailing space (special handling required);
CHANGE #S_LINETXT '''Once the change has been made, the client extraction algorithms using this ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
CHANGE #S_LINETXT '''data field would need to be modified.''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
* new line (hard return detected);
CHANGE #S_LINENO 6;
;
CHANGE #S_LINECTN 1;
* note: trailing space (special handling required);
CHANGE #S_LINETXT '''If the change is from alpha to numeric, can we expect to have to deal with ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
CHANGE #S_LINETXT '''alpha strings that contain decimal points?''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
* Finish writing to the multiline memo box;
EXECUTE ENDMEMO;
;
endroutine;
;
*;
* process a new piece of text stream to be written to a multi-line memo edit box;
*;
subroutine ADDTOMEMO parms(#S_200NLIN #S_200NCTN #S_200NTXT);
IF '#S_200NLIN *NE #S_200PLIN ';
IF '#S_200PLIN *NE 0';
* a new line has arrived - write out the old line to the multiline edit box;
execute WRITELINE;
endif;
* Initialise for the next line;
CLR_LIST #S_LSTLINE;
CHANGE #S_200PLIN #S_200NLIN;
endif;
;
* store all the entries belonging to a line in a working list;
execute ADDTOLINE with_parms(#S_200NLIN #S_200NCTN #S_200NTXT);
endroutine;
;
*;
* finish writing to a multi-line memo edit box;
*;
subroutine ENDMEMO;
* write the last line to the multi-line memo edit box;
execute WRITELINE;
endroutine;
;
*;
* store all the entries belonging to a line in a working list;
*;
subroutine ADDTOLINE parms(#S_LINENO #S_LINECTN #S_LINETXT);
DEF_LIST NAME(#S_LSTLINE) FIELDS(#S_LINENO #S_LINECTN #S_LINETXT) TYPE(*WORKING) ENTRYS(1000);
ADD_ENTRY #S_LSTLINE;
endroutine;
;
*;
* Write the accumulated list of text entries belonging to a single line to the multiline memo edit box.;
*;
subroutine WRITELINE;
;
* Leading spaces are handled without additional processing, but trailing spaces are lost.;
* Therefore trailing spaces must be converted into leading spaces on the next entry.;
;
* Initialise;
CHANGE (#S_200LBFR #S_200LNB #S_200LSPC #S_200SPOS #S_200OBFR) *NULL;
;
* Read through the list for the line;
SELECTLIST #S_LSTLINE;
;
DEFINE #S_200LEN *DEC 3 0 desc('The length of the text field') default(75);
DEFINE #S_200LBFR *DEC 3 0 desc('The length of buffer in use');
DEFINE #S_200LNB *DEC 3 0 desc('The non-blank length');
DEFINE #S_200LSPC *DEC 3 0 desc('Number of spaces at the end of the line');
;
DEFINE #S_200SPOS *DEC 3 0 desc('Start position in a string');
;
* Note how S_200TXT and new buffer overlay old buffer;
DEFINE #S_200OBFR *CHAR 256 desc('Old Buffer');
DEFINE FIELD(#S_200TXT) TYPE(*CHAR) LENGTH(75) TO_OVERLAY(#S_200OBFR);
DEFINE FIELD(#S_200NBFR) TYPE(*CHAR) LENGTH(181) TO_OVERLAY(#S_200OBFR 76);
;
* create the text to be added to the memo box, using the buffer from the previous entry and the next working list entry;
CHANGE #S_200SPOS '#S_200LBFR + 1';
substring (#S_LINETXT) (#S_200OBFR #S_200SPOS *END);
CHANGE #S_LINETXT #S_200TXT;
;
ADD_ENTRY #MEMO_1;
;
* Get ready for the next entry;
* Does the entry just created end with a space or spaces?;
USE TCONCAT (#S_LINETXT ''' ''')(#S_LINETXT #S_200LNB);
CHANGE #S_200LSPC '#S_200LEN - #S_200LNB';
;
if '#S_200LSPC *GT 0';
* the spaces must be added to the new buffer in front of the remainder of the buffer.;
;
CHANGE #S_200SPOS '#S_200LSPC + 1';
CHANGE #S_200TXT *NULL;
substring #S_200NBFR (#S_200OBFR #S_200SPOS *END);
;
* how long is the buffer now?;
CHANGE #S_200LBFR '#S_200LSPC + #S_200LBFR';
else;
* Note that CHANGE cannot be used with overlay fields because it blanks out both.;
SUBSTRING #S_200NBFR #S_200OBFR;
* #S_200LBFR remains the same;
endif;
endselect;
;
IF '#S_200OBFR *NE *BLANKS';
* add a last line-continuation to clear anything left in the buffer.;
CHANGE #S_LINETXT #S_200TXT;
CHANGE #S_LINECTN '#S_LINECTN + 1';
ADD_ENTRY #MEMO_1;
endif;
endroutine;
;
;
END_COM;
*===================================================================;
*;
* Component : S_200FC;
* Type : Form;
* Ancestor : PRIM_FORM (Primitive Form);
*;
* Description : Investigate the memo box in more detail;
*;
* Disclaimer : The following material is supplied as sample material;
* only. No warranty concerning this material or its use;
* in any way whatsoever is expressed or implied.;
*;
* ===================================================================;
;
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM FORMPOSITION(ScreenCenter) HEIGHT(550) LEFT(296) TOP(117) VISUALSTYLE(#VS_NORM) WIDTH(860);
DEFINE_COM CLASS(#PRIM_MEMO) NAME(#MEMO_1) ADDENTRYMODE(MultiplePerLine) CURRENTLINE(1) DISPLAYPOSITION(1) HEIGHT(153) LEFT(8) MAXIMUMLINELENGTH(10000) PARENT(#COM_OWNER) POPUPMENU(#PMNU_1) TABPOSITION(1) TOP(48) WIDTH(200) WORDWRAP(True);
DEFINE_COM CLASS(#PRIM_MECL) NAME(#MECL_1) COLUMNROLE(Data) DISPLAYPOSITION(1) PARENT(#MEMO_1) SOURCE(#S_LINETXT) WIDTH(20);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_CUT) CAPTION('Cut') DISPLAYPOSITION(2) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(2) TOP(208) WIDTH(49);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_COPY) CAPTION('Copy') DISPLAYPOSITION(3) LEFT(72) PARENT(#COM_OWNER) TABPOSITION(3) TOP(208) WIDTH(49);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_PASTE) CAPTION('Paste') DISPLAYPOSITION(4) LEFT(136) PARENT(#COM_OWNER) TABPOSITION(4) TOP(208) WIDTH(49);
DEFINE_COM CLASS(#PRIM_LTVW) NAME(#LTVW_1) DISPLAYPOSITION(5) FULLROWSELECT(True) HEIGHT(201) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(5) TOP(312) VISUALSTYLE(#VS_FIXED) WIDTH(833);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_DISP) CAPTION('Display contents of memo box in list') DISPLAYPOSITION(6) LEFT(8) PARENT(#COM_OWNER) TABPOSITION(6) TOP(264) WIDTH(201);
DEFINE_COM CLASS(#PRIM_MECL) NAME(#MECL_2) COLUMNROLE(LineNumber) DISPLAYPOSITION(2) PARENT(#MEMO_1) SOURCE(#S_LINENO) WIDTH(20);
DEFINE_COM CLASS(#PRIM_MECL) NAME(#MECL_3) COLUMNROLE(LineContinuation) DISPLAYPOSITION(3) PARENT(#MEMO_1) SOURCE(#S_LINECTN) WIDTH(20);
DEFINE_COM CLASS(#PRIM_LVCL) NAME(#LVCL_1) CAPTION('Line') CAPTIONTYPE(Caption) DISPLAYPOSITION(1) PARENT(#LTVW_1) SOURCE(#S_LINENO) WIDTH(8);
DEFINE_COM CLASS(#PRIM_LVCL) NAME(#LVCL_2) CAPTION('Continuation') CAPTIONTYPE(Caption) DISPLAYPOSITION(2) PARENT(#LTVW_1) SOURCE(#S_LINECTN) WIDTH(12);
DEFINE_COM CLASS(#PRIM_LVCL) NAME(#LVCL_3) DISPLAYPOSITION(3) PARENT(#LTVW_1) SOURCE(#S_LINETXT) WIDTH(20) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_1) CAPTION('Save Memo box as') DISPLAYPOSITION(1) HEIGHT(76) LAYOUTMANAGER(#FWLM_1) LEFT(8) PARENT(#GPBX_2) TABPOSITION(1) TABSTOP(False) TOP(15) WIDTH(217);
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_SVDB) BUTTONCHECKED(True) CAPTION('database records in file S200NTE') DISPLAYPOSITION(1) LEFT(13) PARENT(#GPBX_1) TABPOSITION(1) TOP(30) WIDTH(190);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_1) DIRECTION(TopToBottom) FLOWOPERATION(Center) FLOWOPERATIONVER(Spread);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_2) MANAGE(#RDBN_SVDB) PARENT(#FWLM_1);
DEFINE_COM CLASS(#S_200ID.Visual) NAME(#S_200ID) CAPTION('Use this text to identify your note when loading and saving from the database') DISPLAYPOSITION(7) HEIGHT(19) LABELTYPE(Caption) LEFT(8) MARGINLEFT(400) PARENT(#COM_OWNER) TABPOSITION(7) TOP(14) WIDTH(693);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_SAVE) CAPTION('Save Memo Box') DISPLAYPOSITION(2) LEFT(8) PARENT(#GPBX_2) TABPOSITION(2) TOP(104) WIDTH(217);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_2) DISPLAYPOSITION(8) HEIGHT(137) LAYOUTMANAGER(#FWLM_2) LEFT(232) PARENT(#COM_OWNER) TABPOSITION(8) TABSTOP(False) TOP(48) WIDTH(233);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_2) DIRECTION(TopToBottom) FLOWOPERATION(Center) FLOWOPERATIONVER(Spread);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_3) MANAGE(#GPBX_1) PARENT(#FWLM_2);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_4) MANAGE(#PHBN_SAVE) PARENT(#FWLM_2);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_3) DISPLAYPOSITION(9) HEIGHT(137) LAYOUTMANAGER(#FWLM_4) LEFT(472) PARENT(#COM_OWNER) TABPOSITION(9) TABSTOP(False) TOP(48) WIDTH(233);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#GPBX_4) CAPTION('Load Memo box from') DISPLAYPOSITION(1) HEIGHT(81) LAYOUTMANAGER(#FWLM_3) PARENT(#GPBX_3) TABPOSITION(1) TABSTOP(False) TOP(13) WIDTH(212);
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_LDPG) CAPTION('simulated text stream') DISPLAYPOSITION(1) LEFT(30) PARENT(#GPBX_4) TABPOSITION(1) TOP(14) WIDTH(151);
DEFINE_COM CLASS(#PRIM_RDBN) NAME(#RDBN_LDDB) CAPTION('database file S200NTE') DISPLAYPOSITION(2) LEFT(30) PARENT(#GPBX_4) TABPOSITION(2) TOP(50) WIDTH(151);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_3) DIRECTION(TopToBottom) FLOWOPERATION(Center) FLOWOPERATIONVER(Spread);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_5) MANAGE(#RDBN_LDPG) PARENT(#FWLM_3);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_6) MANAGE(#RDBN_LDDB) PARENT(#FWLM_3);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_LOAD) CAPTION('Load Memo box') DISPLAYPOSITION(2) PARENT(#GPBX_3) TABPOSITION(2) TOP(106) WIDTH(208);
DEFINE_COM CLASS(#PRIM_FWLM) NAME(#FWLM_4) DIRECTION(TopToBottom) FLOWOPERATION(Center) FLOWOPERATIONVER(Spread);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_8) MANAGE(#GPBX_4) PARENT(#FWLM_4);
DEFINE_COM CLASS(#PRIM_FWLI) NAME(#FWLI_9) MANAGE(#PHBN_LOAD) PARENT(#FWLM_4);
DEFINE_COM CLASS(#PRIM_PMNU) NAME(#PMNU_1);
DEFINE_COM CLASS(#PRIM_MITM) NAME(#MITM_CUT) CAPTION('Cut') DISPLAYPOSITION(1) PARENT(#PMNU_1);
DEFINE_COM CLASS(#PRIM_MITM) NAME(#MITM_COPY) CAPTION('Copy') DISPLAYPOSITION(2) PARENT(#PMNU_1);
DEFINE_COM CLASS(#PRIM_MITM) NAME(#MITM_PASTE) CAPTION('Paste') DISPLAYPOSITION(3) PARENT(#PMNU_1);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_1) DISPLAYPOSITION(10) HEIGHT(113) LAYOUTMANAGER(#ATLM_1) LEFT(232) PARENT(#COM_OWNER) TABPOSITION(10) TABSTOP(False) TOP(192) VISUALSTYLE(#VS_PANEL) WIDTH(473);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_1);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('This example demonstrates how text can be loaded into a memo box from a text stream or other data source and then edited and saved as a note to a database file. As long as the text stream has been processed once, before loading into the memo box for the first time, subsequent loads and saves of the memo text from/to the database require no special processing.') DISPLAYPOSITION(1) HEIGHT(72) LEFT(0) PARENT(#PANL_1) TABPOSITION(1) TABSTOP(False) TOP(0) WIDTH(469);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_1) ATTACHMENT(Center) MANAGE(#LABL_1) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_2) CAPTION('The list view below shows how the memo text is stored. Note how entries that end with a blank have had another blank automatically added to the beginning of the next entry.') DISPLAYPOSITION(2) HEIGHT(37) LEFT(0) PARENT(#PANL_1) TABPOSITION(2) TABSTOP(False) TOP(72) WIDTH(469);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_2) ATTACHMENT(Bottom) MANAGE(#LABL_2) PARENT(#ATLM_1);
;
;
GROUP_BY NAME(#S_GRPNTE) FIELDS(#S_200ID #S_LINENO #S_LINECTN #S_LINETXT);
DEFINE #S_200NLIN reffld(#S_LINENO) desc('New line number');
DEFINE #S_200PLIN reffld(#S_LINENO) desc('Previous line number');
DEFINE #S_200NCTN reffld(#S_LINECTN) desc('New continuation number');
DEFINE #S_200NTXT reffld(#S_LINETXT) desc('New text');
;
;
EVTROUTINE handling(#com_owner.Initialize);
SET #com_owner caption(*component_desc);
;
set (#RDBN_LDPG #RDBN_SVDB) ButtonChecked(TRUE);
;
execute LDPGM;
execute LD_LSTVW;
;
ENDROUTINE;
;
*;
* initialise in preparation for writing to a multi-line memo edit box;
*;
subroutine STARTMEMO;
clr_list #MEMO_1;
* note that the character position must be reset for new memos;
set #MEMO_1 CharacterPosition(0);
clr_list #S_LSTLINE;
CHANGE #S_200PLIN 0;
endroutine;
;
EVTROUTINE HANDLING(#PHBN_CUT.Click #MITM_CUT.Click);
invoke #MEMO_1.Cut;
ENDROUTINE;
EVTROUTINE HANDLING(#PHBN_COPY.Click #MITM_COPY.Click);
invoke #MEMO_1.Copy;
ENDROUTINE;
EVTROUTINE HANDLING(#PHBN_PASTE.Click #MITM_PASTE.Click);
invoke #MEMO_1.Paste;
ENDROUTINE;
;
*;
* Show the contents of the memo box in a list view;
*;
EVTROUTINE HANDLING(#PHBN_DISP.Click);
execute LD_LSTVW;
endroutine;
subroutine LD_LSTVW;
CLR_LIST #LTVW_1;
SELECTLIST #MEMO_1;
ADD_ENTRY #LTVW_1;
endselect;
ENDROUTINE;
;
*;
* Save the note to file;
*;
EVTROUTINE HANDLING(#PHBN_SAVE.Click);
* Note how no special handling is required;
IF '#RDBN_SVDB.ButtonChecked *eq TRUE';
DELETE S200NTE with_key(#S_200ID);
SELECTLIST #MEMO_1;
INSERT #S_GRPNTE S200NTE;
ENDSELECT;
ENDIF;
ENDROUTINE;
;
*;
* Load the memo box, either using program generated text stream, or from file;
*;
EVTROUTINE HANDLING(#PHBN_LOAD.Click);
IF '#RDBN_LDPG.ButtonChecked *eq TRUE';
* demonstrate loading a text stream to a multiline memo edit box;
execute LDPGM;
endif;
IF '#RDBN_LDDB.ButtonChecked *eq TRUE';
* an ordinary load of memo box data into a memo box;
* Note how no special handling is required.;
EXECUTE STARTMEMO;
;
SELECT #S_GRPNTE S200NTE with_key(#S_200ID);
* database note info has already been processed for trailing spaces;
* (either the text-stream load processed the trailing spaces;
* or the text was originally entered via the multi-line edit box which automatically adds a leading space to the;
* next line whenever it encounters a trailing space);
* hence the note info can be added directly.;
;
ADD_ENTRY #MEMO_1;
ENDSELECT;
endif;
;
ENDROUTINE;
;
;
;
* ==========================================================================================;
*;
* Logic for adding a text stream to a multiline memo edit box;
*;
* ==========================================================================================;
;
;
*;
* Generate some example text for the memo box;
*;
Subroutine LDPGM;
* Note #S_LINETXT is 75 characters, and each value except the last one should be exactly 75 characters;
* This simulates a text stream, arriving as a series of blocks of equal length.;
;
* Leading spaces are handled without additional processing, but trailing spaces are lost.;
* Therefore trailing spaces must be converted into leading spaces on the next entry.;
CHANGE #S_200ID '''PROGRAM GENERATED''';
;
* Start writing to a multi-line memo edit box;
EXECUTE STARTMEMO;
;
CHANGE #S_LINENO 1;
;
CHANGE #S_LINECTN 1;
* note: trailing space at the end of an entry (special handling required);
CHANGE #S_LINETXT '''The following long and tedious piece of text did not originate from a memo ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
CHANGE #S_LINETXT '''box and has been programmatically loaded into the memo box. It demonstrates''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 3;
* note: leading space (no special handling required);
* note: trailing spaces at the end of the last entry of a line (no special handling required);
CHANGE #S_LINETXT ''' that trailing blanks in a block require special handling.''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
*new line;
CHANGE #S_LINENO 2;
;
CHANGE #S_LINECTN 1;
CHANGE #S_LINETXT '''*************************''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
*new line;
CHANGE #S_LINENO 3;
;
CHANGE #S_LINECTN 1;
* note: trailing space (special handling required);
CHANGE #S_LINETXT '''The value for a data field for an item is held in one of two fields on the ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
* note: trailing space (special handling required);
CHANGE #S_LINETXT '''item data field record, according to whether the data field is defined as ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 3;
CHANGE #S_LINETXT '''alpha or numeric. This presents various problems if the XDB administrator c''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 4;
CHANGE #S_LINETXT '''hanges the definition of the data field from alpha to numeric: The action i''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 5;
CHANGE #S_LINETXT '''nitiated from the front end needs to be capable of being performed in two p''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 6;
CHANGE #S_LINETXT '''arts, firstly a validation pass that makes sure that all of the existing va''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 7;
CHANGE #S_LINETXT '''lues conform to the new definition, and then secondly, if valid, a pass thr''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 8;
CHANGE #S_LINETXT '''ough the data that actually performs the move of the values, from one field''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 9;
* note: leading space (no special handling required);
* note trailing spaces for the last entry of a line (no special handling required);
CHANGE #S_LINETXT ''' to the other.''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
* new line (hard return detected);
CHANGE #S_LINENO 4;
;
CHANGE #S_LINECTN 1;
CHANGE #S_LINETXT '''While the change is taking place (a matter of some seconds), the users must''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
* note: leading space (no special handling required);
CHANGE #S_LINETXT ''' not be allowed to update the value for this data field for an item. Even a''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 3;
CHANGE #S_LINETXT '''ttempting merely to view the item data field could cause the system to give''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 4;
* note: leading space (no special handling required);
* note trailing spaces for the last entry of a line (no special handling required);
CHANGE #S_LINETXT ''' unpredictable results.''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
* new line (hard return detected);
CHANGE #S_LINENO 5;
;
CHANGE #S_LINECTN 1;
* note: trailing space (special handling required);
CHANGE #S_LINETXT '''Once the change has been made, the client extraction algorithms using this ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
CHANGE #S_LINETXT '''data field would need to be modified.''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
* new line (hard return detected);
CHANGE #S_LINENO 6;
;
CHANGE #S_LINECTN 1;
* note: trailing space (special handling required);
CHANGE #S_LINETXT '''If the change is from alpha to numeric, can we expect to have to deal with ''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
CHANGE #S_LINECTN 2;
CHANGE #S_LINETXT '''alpha strings that contain decimal points?''';
EXECUTE ADDTOMEMO with_parms(#S_LINENO #S_LINECTN #S_LINETXT);
;
* Finish writing to the multiline memo box;
EXECUTE ENDMEMO;
;
endroutine;
;
*;
* process a new piece of text stream to be written to a multi-line memo edit box;
*;
subroutine ADDTOMEMO parms(#S_200NLIN #S_200NCTN #S_200NTXT);
IF '#S_200NLIN *NE #S_200PLIN ';
IF '#S_200PLIN *NE 0';
* a new line has arrived - write out the old line to the multiline edit box;
execute WRITELINE;
endif;
* Initialise for the next line;
CLR_LIST #S_LSTLINE;
CHANGE #S_200PLIN #S_200NLIN;
endif;
;
* store all the entries belonging to a line in a working list;
execute ADDTOLINE with_parms(#S_200NLIN #S_200NCTN #S_200NTXT);
endroutine;
;
*;
* finish writing to a multi-line memo edit box;
*;
subroutine ENDMEMO;
* write the last line to the multi-line memo edit box;
execute WRITELINE;
endroutine;
;
*;
* store all the entries belonging to a line in a working list;
*;
subroutine ADDTOLINE parms(#S_LINENO #S_LINECTN #S_LINETXT);
DEF_LIST NAME(#S_LSTLINE) FIELDS(#S_LINENO #S_LINECTN #S_LINETXT) TYPE(*WORKING) ENTRYS(1000);
ADD_ENTRY #S_LSTLINE;
endroutine;
;
*;
* Write the accumulated list of text entries belonging to a single line to the multiline memo edit box.;
*;
subroutine WRITELINE;
;
* Leading spaces are handled without additional processing, but trailing spaces are lost.;
* Therefore trailing spaces must be converted into leading spaces on the next entry.;
;
* Initialise;
CHANGE (#S_200LBFR #S_200LNB #S_200LSPC #S_200SPOS #S_200OBFR) *NULL;
;
* Read through the list for the line;
SELECTLIST #S_LSTLINE;
;
DEFINE #S_200LEN *DEC 3 0 desc('The length of the text field') default(75);
DEFINE #S_200LBFR *DEC 3 0 desc('The length of buffer in use');
DEFINE #S_200LNB *DEC 3 0 desc('The non-blank length');
DEFINE #S_200LSPC *DEC 3 0 desc('Number of spaces at the end of the line');
;
DEFINE #S_200SPOS *DEC 3 0 desc('Start position in a string');
;
* Note how S_200TXT and new buffer overlay old buffer;
DEFINE #S_200OBFR *CHAR 256 desc('Old Buffer');
DEFINE FIELD(#S_200TXT) TYPE(*CHAR) LENGTH(75) TO_OVERLAY(#S_200OBFR);
DEFINE FIELD(#S_200NBFR) TYPE(*CHAR) LENGTH(181) TO_OVERLAY(#S_200OBFR 76);
;
* create the text to be added to the memo box, using the buffer from the previous entry and the next working list entry;
CHANGE #S_200SPOS '#S_200LBFR + 1';
substring (#S_LINETXT) (#S_200OBFR #S_200SPOS *END);
CHANGE #S_LINETXT #S_200TXT;
;
ADD_ENTRY #MEMO_1;
;
* Get ready for the next entry;
* Does the entry just created end with a space or spaces?;
USE TCONCAT (#S_LINETXT ''' ''')(#S_LINETXT #S_200LNB);
CHANGE #S_200LSPC '#S_200LEN - #S_200LNB';
;
if '#S_200LSPC *GT 0';
* the spaces must be added to the new buffer in front of the remainder of the buffer.;
;
CHANGE #S_200SPOS '#S_200LSPC + 1';
CHANGE #S_200TXT *NULL;
substring #S_200NBFR (#S_200OBFR #S_200SPOS *END);
;
* how long is the buffer now?;
CHANGE #S_200LBFR '#S_200LSPC + #S_200LBFR';
else;
* Note that CHANGE cannot be used with overlay fields because it blanks out both.;
SUBSTRING #S_200NBFR #S_200OBFR;
* #S_200LBFR remains the same;
endif;
endselect;
;
IF '#S_200OBFR *NE *BLANKS';
* add a last line-continuation to clear anything left in the buffer.;
CHANGE #S_LINETXT #S_200TXT;
CHANGE #S_LINECTN '#S_LINECTN + 1';
ADD_ENTRY #MEMO_1;
endif;
endroutine;
;
;
END_COM;