Examples

Application Controlled Memo Editing

Any characters following the first tilde (~) in the TEXT parameter will be processed exactly as if they were entered from the keyboard (provided this is not a NO-FILE memo. See next example for that.) This allows the application to transfer text from another source into memo pads. All other parameters should be set up as for an Edit Memo Pad call:

opcode same as for the Edit Memo Pad call described above, except that you might want to add the MMO'SIL option to turn off the display. This is useful for speed and visual cleanliness when you are transferring a lot of text and you aren't going to allow editing from the keyboard after the text is complete. (Keyboard editing will be difficult without any display)

text may contain an optional prompt (as with the display and edit operations), followed by a tilde (~) and then the string of characters. There is no particular limit to the length of the string, other than that you have to map the string in your program (and thus provide memory for it). Obviously, you have to define a large enough memo pad (via the VSPEC parameter) to hold the text characters.

channel, strow, stcol, endrow and endcol are set the same as in the display or edit memo pad call (see above).

link depends on whether you want to start a brand new memo pad or modify an old one, just as with the edit memo pad call. If you are adding to an existing memo, you will probably want to use a Control-E and a carriage return in your text string to move the cursor to the end of the memo.

vspec should be set to control the limits of horizontal and vertical scrolling of the memo window. POS is set to zero if no error occurred, otherwise it will contain the error code.

extcod and exterr will be set the same as for a normal editing session.

Note that if you are transferring text from one memo pad to another, you may wish to use the XFRMMO.SBR utility, which is faster and easier than retrieving the text from one memo a line at a time and loading it into another. The following example illustrates an approach to time and date stamping memo entries:

OPCODE = MMO'EDT + MMO'BDR + MMO'LID

TEXT = PROMPT$ + "~"

IF LINK<>0 TEXT = TEXT + chr$(5) + chr$(13)

TEXT = TEXT + TODAY$ + " " + HOUR$ + " "

XCALL INMEMO,OPCODE,TEXT,CHAN,STROW,STCOL,ENDROW, &

ENDCOL,LINK,XPOS,VSPEC,MMOCLR,EXTCTL

IF POS <> 0 CALL INMEMO'ERROR'RECOVERY

Note that if this is a new memo, we can start at the beginning. Otherwise, we use a Control-E and carriage return (chr$(5)+chr$(13)) to move to the end and start a new line. The cursor will be left just past the HOUR$ for the user to enter the text.