SET SCOREBOARD

SET SCOREBOARD

Toggle the message display from READ or MEMOEDIT()

Syntax

      SET SCOREBOARD ON | off | <xlToggle>

Arguments

ON allows the display of messages from READ and MEMOEDIT() on line zero of the screen.

OFF suppresses these messages.

<xlToggle> is a logical expression that must be enclosed in parentheses. A value of true (.T.) is the same as ON, and a value of false (.F.) is the same as OFF.

Description

SET SCOREBOARD controls whether or not messages from READ and MEMOEDIT() display on line zero. When SCOREBOARD is ON, READ displays messages for RANGE errors, invalid dates, and insert status. MEMOEDIT() displays an abort query message and the insert status.

To suppress the automatic display of these messages, SET SCOREBOARD OFF.

Seealso

@…GET, MEMOEDIT(), READ

MemoWrit()

MEMOWRIT()

Write a memo field or character string to a text file on disk

Syntax

      MEMOWRIT( <cFileName>, <cString>, [<lWriteEof>] ) --> lSuccess

Arguments

<cFileName> is the filename to read from disk. It must include the file extension. If file to be read lives in another directory, you must include the path.

<cString> Is the memo field or character string, to be write to <cFile>.

<lWriteEof> Is a logic variable that settle if the “end of file” character – CHR(26) – is written to disk. This parameter is optional. By default is true (.T.)

Returns

Function returns true (.T.) if the writing operation was successful; otherwise, it returns false (.F.).

Description

This a function that writes a memo field or character string to a text file on disk (floppy, HD, CD-ROM, etc.) If you not specified a path, MEMOWRIT() writes <cFileName> to the current directory. If <cFileName> exists, it is overwritten.

There is a third parameter (optional), <lWriteEof>, (not found in CA-Cl*pper) which let to programmer change the default behavior of – always – to write the EOF character, CHR(26) as in CA-Cl*pper.

If there is no third parameter, nothing change, EOF is written as in CA-Cl*pper, the same occurs when <lWriteEof> is set to .T. But, if <lWriteEof> is set to .F., EOF char is Not written to the end of the file.

MEMOWRIT() function is used together with MEMOREAD() and MEMOEDIT() to save to disk text from several sources that was edited, searched, replaced, displayed, etc.

Note that MEMOWRIT() do not use the directory settings SET DEFAULT.

Examples

      *  This example uses MEMOWRIT() to write the contents of a character
         variable to a text file.

         cFile   := "account.prg"
         cString := MEMOREAD( cFile )

         IF At( "Melina", cString ) == 0            // check for copyright
            MEMOWRIT( cFile, cCopyright + cString ) // if not, add it!
         ENDIF

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

MEMOEDIT(), MEMOREAD(), HB_MEMOWRIT()

MemoRead()

MEMOREAD()

Return the text file’s contents as a character string

Syntax

      MEMOREAD( <cFileName> ) --> cString

Arguments

<cFileName> is the filename to read from disk. It must include the file extension. If file to be read lives in another directory, you must include the path.

Returns

Returns the contents of a text file as a character string.

If <cFileName> cannot be found or read MEMOREAD returns an empty string (“”).

Description

MEMOREAD() is a function that reads the content of a text file (till now) from disk (floppy, HD, CD-ROM, etc.) into a memory string. In that way you can manipulate as any character string or assigned to a memo field to be saved in a database.

MEMOREAD() function is used together with MEMOEDIT() and MEMOWRIT() to get from disk text from several sources that would be edited, searched, replaced, displayed, etc.

It is used to import data from other sources to our database.

Note: MEMOREAD() does not use the settings SET DEFAULT or SET PATH to search for <cFileName>. It searches for <cFileName> in the current directory. If the file is not found, then MEMOREAD() searches in the DOS path.

Over a network, MEMOREAD() attempts to open <cFileName> in read-only mode and shared. If the file is used in mode exclusive by another process, the function will returns a null string (“”).

Examples

      *  This example uses MEMOREAD() to assign the contents of a text
      *  file to a character variable for later search

         cFile   := "account.prg"
         cString := MEMOREAD( cFile )
         cCopyright := "Melina"

         IF At( "Melina", cString ) == 0            // check for copyright
            MEMOWRIT( cFile, cCopyright + cString ) // if not, add it!
         ENDIF

Compliance

Clipper

Platforms

All (64K)

Files

Library is rtl

Seealso

MEMOEDIT(), MEMOWRIT(), REPLACE, HB_MEMOREAD()

hb_MemoWrit()

HB_MEMOWRIT()

Write a memo field or character string to a text file on disk

Syntax

      HB_MEMOWRIT( <cFileName>, <cString>, [<lWriteEof>] ) --> lSuccess

Arguments

<cFileName> is the filename to read from disk. It must include the file extension. If file to be read lives in another directory, you must include the path.

<cString> Is the memo field or character string, to be write to <cFile>.

<lWriteEof> Is a logic variable that settle if the “end of file” character – CHR(26) – is written to disk. This parameter is optional. By default is true (.T.)

Returns

Function returns true (.T.) if the writing operation was successful; otherwise, it returns false (.F.).

Description

This a function that writes a memo field or character string to a text file on disk (floppy, HD, CD-ROM, etc.) If you not specified a path, HB_MEMOWRIT() writes <cFileName> to the current directory. If <cFileName> exists, it is overwritten.

There is a third parameter (optional), <lWriteEof>, (not found in CA-Cl*pper) which let to programmer change the default behavior of – always – to write the EOF character, CHR(26) as in CA-Cl*pper.

If there is no third parameter, nothing change, EOF is written as in CA-Cl*pper, the same occurs when <lWriteEof> is set to .T. But, if <lWriteEof> is set to .F., EOF char is Not written to the end of the file.

HB_MEMOWRIT() function is used together with HB_MEMOREAD() and MEMOEDIT() to save to disk text from several sources that was edited, searched, replaced, displayed, etc.

Note that HB_MEMOWRIT() do not use the directory settings SET DEFAULT.

HB_MEMOWRIT() vs MEMOWRIT(): HB_MEMOWRIT() never writes the obsolete EOF char at the end of the file.

Examples

      *  This example uses HB_MEMOWRIT() to write the contents of a character
      *  variable to a text file.

         cFile   := "account.prg"
         cString := HB_MEMOREAD( cFile )
         cCopyright := "Melina"

         IF At( "Melina", cString ) == 0               // check for copyright
            HB_MEMOWRIT( cFile, cCopyright + cString ) // if not, add it!
         ENDIF

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

MEMOEDIT(), MEMOREAD(), HB_MEMOWRIT()

hb_MemoRead()

HB_MEMOREAD()

Return the text file’s contents as a character string

Syntax

      HB_MEMOREAD( <cFileName> ) --> cString

Arguments

<cFileName> is the filename to read from disk. It must include the file extension. If file to be read lives in another directory, you must include the path.

Returns

Returns the contents of a text file as a character string.

If <cFileName> cannot be found or read HB_MEMOREAD returns an empty string (“”).

Description

HB_MEMOREAD() is a function that reads the content of a text file (till now) from disk (floppy, HD, CD-ROM, etc.) into a memory string. In that way you can manipulate as any character string or assigned to a memo field to be saved in a database.

HB_MEMOREAD() function is used together with MEMOEDIT() and HB_MEMOWRIT() to get from disk text from several sources that would be edited, searched, replaced, displayed, etc.

It is used to import data from other sources to our database.

Note: HB_MEMOREAD() does not use the settings SET DEFAULT or SET PATH to search for <cFileName>. It searches for <cFileName> in the current directory. If the file is not found, then HB_MEMOREAD() searches in the DOS path.

Over a network, HB_MEMOREAD() attempts to open <cFileName> in read-only mode and shared. If the file is used in mode exclusive by another process, the function will returns a null string (“”).

HB_MEMOREAD() vs MEMOREAD(): HB_MEMOREAD() is identical to MEMOREAD() except it won’t truncate the last byte (on non-UNIX compatible systems) if it’s a EOF char.

Examples

      *  This example uses HB_MEMOREAD() to assign the contents of a text
      *  file to a character variable for later search

         cFile   := "account.prg"
         cString := HB_MEMOREAD( cFile )
         cCopyright := "Melina"

         IF At( "Melina", cString ) == 0               // check for copyright
            HB_MEMOWRIT( cFile, cCopyright + cString ) // if not, add it!
         ENDIF

Compliance

Clipper

Platforms

All (64K)

Files

Library is rtl

Seealso

MEMOEDIT(), HB_MEMOWRIT(), REPLACE, MEMOREAD()

What is Superlib ?

Superlib Description by Oasis 

The final version of SuperLib, and now it’s FREEWARE, and it comes with 100% SOURCE CODE and extensive norton guide.

SuperLib is a library of functions for Clipper 5.x.

What makes SuperLib different than other libraries on the marketplace is that is contains a large collection of METAFUNCTIONS. A metafunction is like a pre-packaged mini application, ready to link and run. For instance, SuperLib’s report writer is as simple to use as:

USE
REPORTER()

All of the metafunctions are menu-driven and ready to use without modifications. All SuperLib functions are data independant. All that is required is an open DBF file. SuperLib will determine the field structure and use the current DBF. SuperLib requires no special setup or way of doing things. It works with you, not against you. SuperLib functions will do their best to save/restore all settings as they found them. (such as colors, cursor, screens, etc.)

There are over 300 functions in SuperLib, ranging from the metafunctions down to the granular common component functions such as events and popups. (see the function list below, or the .NG file). This version of SuperLib is 100% mouse aware! All SuperLib functions
are automatically aware of the mouse and respond to the mouse.

SuperLib even contains replacements for Clipper’s READ, MENU TO, ACHOICE and MEMOEDIT functions that are mouse aware. Several functions are provided to help you build mouse awareness into your own functions.

SuperLib is Blinker 3.x, 4.x and Exospace compatible for protected mode programs. SuperLib is 99.9 % pure Clipper code, and uses no Clipper internals, which makes for painless upgrading to future versions of Clipper and the various linkers.

SuperLib is network ready, with all locking already built in. (works fine for single-user too)

There is no registration of SuperLib, since it is now freeware. The author, Gary Prefontaine, is no longer supporting the product. If you need help with this library, please ask on comp.lang.clipper

Thanks, Gary.

http://www.the-oasis.net/files/library/supfree.zip

http://www.the-oasis.net/supfree.htm

SP_EDITMEMOV

EDITMEMOV()

  Short:
  ------
  EDITMEMOV() Performs a windowed memoedit() on a string

  Returns:
  --------
  <cBuffer> => changed string

  Syntax:
  -------
  EDITMEMO(cBuffer,[nTop,nLeft,nBottom,nRight],[lModify],;
            [nLineLength],[cTitle])

  Description:
  ------------
  Pops up a box allowing memo editing of a string.
  Edits string <cBuffer>. Options for import and export as well.

  Escape exits, F10 saves [cBuffer]. Uses coordinates
  2,10,20,69 unless passed coordinates as
  [nTop,nLeft,nBottom,nRight]

  [lModify] - True = allow edit (default), False = view
  only

  [nLineLength] - line length - default is window
  width-1

  [cTitle]  Title (max 25 characters) Default is MEMO PAD (new to 3.5)

  Examples:
  ---------
   cNew := editmemov("Good golly miss molly!")
   cNew := editmemov(memoread("DOCS.DOC"),2,2,22,78)
   cNew := editmemov(memoread("DOCS.DOC"),2,2,22,78,.f.)

  Notes:
  -------
  If editing, must have a box width of at least 50.
  Unlike EDITMEMO, this works on a memvar and returns a memvar.

  Source:
  -------
  S_EDITM.PRG

 

SP_EDITMEMO

EDITMEMO()
  Short:
  ------
  EDITMEMO() Performs a windowed memoedit() on a memo field

  Returns:
  --------
  <lChanged> -> Was the memo field changed

  Syntax:
  -------
  EDITMEMO([cMemoName],[nTop,nLeft,nBottom,nRight],;
        [lModify],[nLineLength],[cTitle])

  Description:
  ------------
  Pops up a box allowing editing of a memo field.
  Escape exits, F10 saves.

  Options for import and export as well.

  Edits field named MEMO by default, otherwise edits
  fieldname passed as [cMemoName]. Uses coordinates 2,10,20,69
  unless passed coordinates as [nTop, nLeft, nBottom, nRight]

  [lModify] - True = allow edit (default), False = view only

  [nLineLength] - line length - default is window width-1

  [cTitle]  Title (max 25 characters) Default is MEMO PAD (new to 3.5)

  Examples:
  ---------
   editmemo()
   editmemo("NOTES")
   editmemo("NOTES",2,2,22,78)
   editmemo("NOTES",2,2,22,78,.f.)

  Notes:
  -------
  If editing, must have a box width of at least 50
  Requires a memo FIELD - will not work on a memvar.

  See EDITMEMOV() to edit memvars.

  Source:
  -------
  S_EDITM.PRG

 

C5_MEMOEDIT

 MEMOEDIT()
 Display or edit character strings and memo fields
------------------------------------------------------------------------------
 Syntax

     MEMOEDIT([<cString>],
        [<nTop>], [<nLeft>],
        [<nBottom>], [<nRight>],
        [<lEditMode>],
        [<cUserFunction>],
        [<nLineLength>],
        [<nTabSize>],
        [<nTextBufferRow>],
        [<nTextBufferColumn>],
        [<nWindowRow>],
        [<nWindowColumn>]) --> cTextBuffer

 Arguments

     <cString> is the character string or memo field to copy to the
     MEMOEDIT() text buffer.  If not specified, the text buffer is empty.

     <nTop>, <nLeft>, <nBottom>, and <nRight> are the
     upper-left and lower-right window coordinates.  Row values can range
     from zero to MAXROW(), and column positions can range from zero to
     MAXCOL().  If not specified, the default coordinates are 0, 0, MAXROW(),
     and MAXCOL().

     <lEditMode> determines whether the text buffer can be edited or
     merely displayed.  Specifying true (.T.) allows the user to make changes
     to the text buffer, while specifying false (.F.) only allows the user to
     browse the text buffer.  If not specified, the default value is true
     (.T.).

     <cUserFunction> is the name of a user-defined function that executes
     when the user presses a key not recognized by MEMOEDIT() and when no
     keys are pending in the keyboard buffer.  <cUserFunction> is specified
     as a character value without parentheses or arguments.  Specifying false
     (.F.) for this argument displays <cString> and causes MEMOEDIT() to
     immediately terminate.  If this argument is specified, the automatic
     behavior of MEMOEDIT() changes.  Refer to the discussion below.

     <nLineLength> determines the length of lines displayed in the
     MEMOEDIT() window.  If a line is greater than <nLineLength>, it is word
     wrapped to the next line in the MEMOEDIT() window.  If <nLineLength> is
     greater than the number of columns in the MEMOEDIT() window, the window
     will scroll if the cursor moves past the window border.  If
     <nLineLength> is not specified, the default line length is (<nRight> -
     <nLeft>).

     <nTabSize> determines the tab stops that will be used when the user
     presses Tab.  If <nTabSize> is not specified, tab stops will be placed
     at every four characters.

     <nTextBufferRow> and <nTextBufferColumn> define the display
     position of the cursor within the text buffer when MEMOEDIT() is
     invoked.  <nTextBufferRow> begins with one (1) and <nTextBufferColumn>
     begins with zero (0).  If these arguments are not specified, the cursor
     is placed at row one (1) and column zero (0) of the MEMOEDIT() window.

     <nWindowRow> and <nWindowColumn> define the initial position of
     the cursor within the MEMOEDIT() window.  Row and column positions begin
     with zero (0).  If these arguments are not specified, the initial window
     position is row zero (0) and the current cursor column position.

 Returns

     MEMOEDIT() returns the text buffer if the user terminates editing with
     Ctrl+W or a copy of <cString> if user terminates with Esc.

 Description

     MEMOEDIT() is a user interface and general purpose text editing function
     that edits memo fields and long character strings.  Editing occurs
     within a specified window region placed anywhere on the screen.  Like
     the other user interface functions (ACHOICE() and DBEDIT()), MEMOEDIT()
     supports a number of different modes and includes a user function that
     allows key reconfiguration and other activities relevant to programming
     the current text editing task.

     .  The text buffer: When you invoke MEMOEDIT() and specify
        <cString>, it is copied to the text buffer.  The user actually edits
        the text buffer.  If the <cString> is not specified, the user is
        presented with an empty text buffer to edit.

        When the user exits MEMOEDIT() by pressing Ctrl+W, the contents of
        the text buffer are returned.  If the user exits by pressing  Esc,
        the text buffer is discarded and the original <cString> value is
        returned.  In either case, the return value can then be assigned to a
        variable or memo field, or passed as an argument to another function.

     .  Editing modes: MEMOEDIT() supports two editing modes depending
        on the value of <lEditMode>.  When <lEditMode> is true (.T.),
        MEMOEDIT() enters edit mode and the user can change the contents of
        the MEMOEDIT() text buffer.  When <lEditMode> is false (.F.),
        MEMOEDIT() enters browse mode and the user can only navigate about
        the text buffer but cannot edit or insert new text.  To make browsing
        easier for the user, the scrolling is disabled so Up arrow and Down
        arrow scroll the text buffer up or down one line within the
        MEMOEDIT() window.

     .  Entering and editing text: Within MEMOEDIT(), the user can
        enter and edit text by positioning the cursor, adding, or deleting
        characters.  To facilitate editing the text, there are a number of
        different navigation and editing keys:

        MEMOEDIT() Navigation and Editing Keys
        ---------------------------------------------------------------------
        Key                      Action
        ---------------------------------------------------------------------
        Up arrow/Ctrl+E          Move up one line
        Down arrow/Ctrl+X        Move down one line
        Left arrow/Ctrl+S        Move left one character
        Right arrow/Ctrl+D       Move right one character
        Ctrl+Left arrow/Ctrl+A   Move left one word
        Ctrl+Right arrow/Ctrl+F  Move right one word
        Home                     Move to beginning of current line
        End                      Move to end of current line
        Ctrl+Home                Move to beginning of current window
        Ctrl+End                 Move to end of current window
        PgUp                     Move to previous edit window
        PgDn                     Move to next edit window
        Ctrl+PgUp                Move to beginning of memo
        Ctrl+PgDn                Move to end of memo
        Return                   Move to beginning of next line
        Delete                   Delete character at cursor
        Backspace                Delete character to left of cursor
        Tab                      Insert tab character or spaces
        Printable characters     Insert character
        Ctrl+Y                   Delete the current line
        Ctrl+T                   Delete word right
        Ctrl+B                   Reform paragraph
        Ctrl+V/Ins               Toggle insert mode
        Ctrl+W                   Finish editing with save
        Esc                      Abort edit and return original
        ---------------------------------------------------------------------

        When the user is entering text, there are two text entry modes,
        insert and overstrike.  When MEMOEDIT() is invoked, the default mode
        is overstrike.  Edit mode changes in MEMOEDIT() when the user presses
        Ins which toggles between the insert and overstrike.  It also changes
        in a user function using READINSERT() or RETURNing 22.  In insert
        mode, characters are entered into the text buffer at the current
        cursor position and the remainder of the text moves to the right.
        Insert mode is indicated in the scoreboard area.  In overstrike mode,
        characters are entered at the current cursor position overwriting
        existing characters while the rest of the text buffer remains in its
        current position.

        As the user enters text and the cursor reaches the edge of the
        MEMOEDIT() window, the current line wraps to the next line in the
        text buffer and a soft carriage return (CHR(141)) is inserted into
        the text.  If the <nLineLength> argument is specified, text wraps
        when the cursor position is the same as <nLineLength>.  If
        <nLineLength> is greater than the width of the MEMOEDIT() window, the
        window scrolls.  To explicitly start a new line or paragraph, the
        user must press Return.

     .  The edit screen: When MEMOEDIT() displays, it overwrites the
        specified area of the screen and does not save the underlying screen.
        Additionally, it does not display a border or a title.  To provide
        these facilities, you must create a procedure or user-defined
        function that performs these actions, and then calls MEMOEDIT().  See
        the example below.

     .  The user function: <cUserFunction>, a user-defined function
        specified as an argument, handles key exceptions and reconfigures
        special keys.  The user function is called at various times by
        MEMOEDIT(), most often in response to keys it does not recognize.
        Keys that instigate a key exception are all available control keys,
        function keys, and Alt keys.  Since these keys are not processed by
        MEMOEDIT(), they can be reconfigured.  Some of these keys have a
        default action assigned to them.  In the user function, you perform
        various actions depending on the current MEMOEDIT() mode, and then
        RETURN a value telling MEMOEDIT() what to do next.

        When the user function argument is specified, MEMOEDIT() defines two
        classes of keys: nonconfigurable and key exceptions.  When a
        nonconfigurable key is pressed, MEMOEDIT() executes it; otherwise, a
        key exception is generated and the user function is called.  When
        there are no keys left in the keyboard buffer for MEMOEDIT() to
        process, the user function is called once again.

        When MEMOEDIT() calls the user function, it automatically passes
        three parameters indicating the MEMOEDIT() mode, the current text
        buffer line, and the current text buffer column.  The mode indicates
        the current state of MEMOEDIT() depending on the last key pressed or
        the last action taken prior to executing the user function.  The
        following modes are possible:

        MEMOEDIT() Modes
        ---------------------------------------------------------------------
        Mode    Memoedit.ch    Description
        ---------------------------------------------------------------------
        0       ME_IDLE        Idle, all keys processed
        1       ME_UNKEY       Unknown key, memo unaltered
        2       ME_UNKEYX      Unknown key, memo altered
        3       ME_INIT        Initialization mode
        ---------------------------------------------------------------------

        A mode value of 3 indicates that MEMOEDIT() is in initialization
        mode.  When you specify <cUserFunction>, MEMOEDIT() makes a call to
        the user function immediately after being invoked.  At this point,
        you RETURN a request to set MEMOEDIT()'s various text formatting
        modes: word wrap, scroll, or insert.  MEMOEDIT() calls the user
        function repeatedly, remaining in the initialization mode until you
        RETURN 0.  The text buffer is then displayed, and the user enters the
        edit mode set by <lEditMode>.  Note that if word wrap is on when
        MEMOEDIT() changes from initialization to edit mode, the entire text
        buffer is formatted with <nLineLength>.  To prevent this initial
        formatting, toggle word wrap off during initialization.  Note also
        that the toggles for scroll and word wrap are not assigned to any
        key, but can be assigned to a key from the user function.

        Modes 1 and 2 indicate that MEMOEDIT() has fetched an unrecognizable
        or configurable key from the keyboard buffer.  Configurable keys are
        processed by RETURNing 0 to execute the MEMOEDIT() default action.
        RETURNing a different value executes another key action, thereby
        redefining the key.  If the key is an unrecognizable key, you can
        define an action for it by RETURNing a value requesting a key action
        or perform an action of your own definition.

        Mode 0 indicates that MEMOEDIT() is now idle with no more keys to
        process.  Whenever MEMOEDIT() becomes idle, it always make a call to
        the user function.  At this point, you generally update line and
        column number displays.

        The other two parameters, current line and column, indicate the
        current cursor position in the text buffer when the user function is
        called.  The line parameter begins with position one (1), and column
        begins with position zero (0).

        When the mode is either 1, 2, or 3, you can return a value
        instructing MEMOEDIT() what action to perform next.  The following
        table summarizes the possible return values and their consequences:

        MEMOEDIT() User Function Return Values
        ---------------------------------------------------------------------
        Value   Memoedit.ch         Action
        ---------------------------------------------------------------------
        0       ME_DEFAULT          Perform default action
        1-31    ME_UNKEY            Process requested action corresponding to
                                    key value
        32      ME_IGNORE           Ignore unknown key
        33      ME_DATA             Treat unknown key as data
        34      ME_TOGGLEWRAP       Toggle word wrap mode
        35      ME_TOGGLESCROLL     Toggle scroll mode
        100     ME_WORDRIGHT        Perform word-right operation
        101     ME_BOTTOMRIGHT      Perform bottom-right operation
        ---------------------------------------------------------------------

     .  Header files: To make the mode and request values easier to
        remember and use, the header file Memoedit.ch is supplied in
        \CLIP53\INCLUDE.  Additionally, Inkey.ch, which contains manifest
        constants for all the INKEY() values, is also located in the same
        directory.

 Notes

     .  Configuring keys: If the <cUserFunction> is specified, the
        keys in the table below are configurable.

        MEMOEDIT() Configurable Keys
        ---------------------------------------------------------------------
        Key            Default Action
        ---------------------------------------------------------------------
        Ctrl+Y         Delete the current line
        Ctrl+T         Delete word right
        Ctrl+B         Reform Paragraph
        Ctrl+V/Ins     Toggle insert mode
        Ctrl+W         Finish editing with save
        Esc            Abort edit and return original
        ---------------------------------------------------------------------

        If the key is configurable, RETURNing 0 executes the MEMOEDIT()
        default action.  RETURNing a different value, however, executes
        another key action thereby redefining the key.  If the key is not a
        configurable key recognized by MEMOEDIT(), you can define an action
        for it also by RETURNing a value requesting a key action from the
        table above.

     .  Word wrap: Word wrap is a formatting mode you can toggle by
        RETURNing 34 from the user function.  When word wrap is on (the
        default setting), MEMOEDIT() inserts a soft carriage return/line feed
        at the closest word break to the window border or line length,
        whichever occurs first.  When word wrap is off, MEMOEDIT() scrolls
        text buffer beyond the edge of the window until the cursor reaches
        the end of line.  At this point, the user must press Return
        (inserting a hard carriage return/line feed) to advance to the next
        line.

     .  Reforming paragraphs: Pressing Ctrl+B or RETURNing a 2 from a
        user function reformats the text buffer until a hard carriage return
        (end of paragraph) or the end of the text buffer is reached.  This
        happens regardless of whether word wrap is on or off.

     .  Soft carriage returns: In Clipper, the insertion of soft
        carriage return/linefeed characters is never allowed to change the
        significant content of the text.  That is, when a soft carriage
        return/linefeed is inserted between two words, the space characters
        between the two words are preserved.  When text is reformatted, any
        soft carriage return/linefeed characters are removed.  This leaves
        the text in its original form and properly handles the case where a
        soft carriage return/linefeed has been inserted in the middle of a
        word.

        In the Summer '87 version of MEMOEDIT(), when a soft carriage
        return/line feed is inserted, a single space character is removed
        from the text at that point.  If the text is later reformatted using
        a different line width, each soft carriage return/linefeed is
        replaced by a single space.  However, if the text string is
        reformatted using any of the Clipper text handling functions,
        words that were separated by a soft carriage return/linefeed will be
        run together because the soft carriage return/linefeed is not
        replaced with a space.

        To prevent this, text that was formatted using Summer '87 MEMOEDIT()
        should be processed to change any soft carriage return/linefeed pairs
        into space characters.  This can be accomplished using the STRTRAN()
        function as follows:

        STRTRAN( <text>, CHR(141)+CHR(10), " " )

        To convert memo values in an existing database, the following two
        line program can be used:

        USE <xcDatabase>
        REPLACE ALL <idMemo> WITH ;
           STRTRAN( <idMemo>, CHR(141)+CHR(10), " " )

        Because of the .dbt file format, replacing all occurrences of a memo
        field can cause the .dbt file to grow significantly.  The .dbt file
        can be reduced by copying the .dbf to a new file.

        For very large .dbt files, it may not be feasible to perform the
        above procedure.  The supplied utility program, DBT50.EXE located in
        \CLIP53\BIN, may be useful in these cases.  DBT50 scans an entire
        .dbt file, replacing any soft carriage return/line feed pairs with
        two spaces.  Although this has the undesirable effect of causing
        certain words to be separated by two spaces instead of one, it allows
        the file to be processed in place without using additional disk
        space.  DBT50 modifies only soft carriage return/linefeed pairs in
        the target file.  Other text is unaffected.

     .  Editing text files: MEMOEDIT() edits text files if the text
        file can be read into a Clipper character variable.  This can be
        done with the MEMOREAD() function.  After editing the contents of the
        text file held in the character variable, write it back to the file
        using MEMOWRIT().

 Examples

     .  This example lets you browse a memo field but prevents any
        changes to the text buffer:

        USE Customer NEW
        SET CURSOR OFF
        MEMOEDIT(CustNotes, 5, 10, 20, 69, .F.)
        SET CURSOR ON

     .  This example allows editing of a memo field, assigning the
        changes back to the memo field:

        USE Customer NEW
        REPLACE CustNotes WITH ;
              MEMOEDIT(CustNotes, 5, 10, 20, 69)

     .  This example creates a character string using MEMOEDIT():

        LOCAL cNotes
        cNotes = MEMOEDIT()

     .  This example is a user-defined function that edits a character
        string in a boxed window displayed with a title:

     FUNCTION EditMemo( cString, cTitle,;
                 nTop, nLeft, nBottom, nRight )
           LOCAL cScreen := SAVESCREEN(nTop, nLeft,;
                 nBottom, nRight)
           @ nTop - 1, nLeft - 2 CLEAR TO nBottom + 1,;
                 nRight + 2
           @ nTop - 1, nLeft - 2 TO nBottom + 1, nRight + 2
           @ nTop - 1, nLeft SAY "[" + cTitle + "]"
           cString = MEMOEDIT(cString, nTop, nLeft,;
                 nBottom, nRight)
           RESTSCREEN(nTop, nLeft, nBottom, nRight, cScreen)

           RETURN (cString)

     .  This example reads the contents of a text file into a
        character variable, edits it, and then writes it back to disk:

        LOCAL cString := MEMOREAD("Text.txt")
        cString := MEMOEDIT(cString)
        IF !MEMOWRIT("Text.txt", cString)
           ? "Write error"
           BREAK
        ENDIF
        RETURN

     .  This example contains a user-defined function that displays a
        message describing the current MEMOEDIT() mode.  Additionally, while
        in ME_UNKEY mode, the function will perform either a ME_WORDRIGHT or
        ME_BOTTOMRIGHT action depending on which associated function key is
        pressed:

        #include "Memoedit.ch"
        #include "Inkey.ch"

        PROCEDURE Main()
           USE Customer NEW
           REPLACE CustNotes WITH;
           MEMOEDIT( CustNotes, 5, 5, 15, 75, .T., "MemoUDF" )
        RETURN

        FUNCTION MemoUDF( nMode, nLine, nCol )
           LOCAL nKey := LASTKEY()
           LOCAL nRetVal := ME_DEFAULT         // Default return action

           DO CASE
           CASE nMode == ME_IDLE
              @ 20, 5 SAY "MemoMode is ME_IDLE  "
           CASE nMode == ME_UNKEY
              @ 20, 5 SAY "MemoMode is ME_UNKEY "
              DO CASE
              CASE nKey == K_F2
                 nRetVal := ME_WORDRIGHT
              CASE nKey == K_F3
                 nRetVal := ME_BOTTOMRIGHT
              ENDCASE
              CASE nMode == ME_UNKEYX
              @ 20, 5 SAY "MemoMode is ME_UNKEYX"
           OTHERWISE
              @ 20, 5 SAY "MemoMode is ME_INIT  "
           ENDCASE

        RETURN nRetVal

 Files   Library is EXTEND.LIB, header files are Memoedit.ch and Inkey.ch.

See Also: HARDCR() LASTKEY() MEMOLINE() MEMOREAD() MEMOTRAN()

Simple Clipper Extensions

Simple extensions

Exact comparisons,
Name precedence,
SELECT 0,
Alias functions,
Call by reference and value,
Other Clipper extensions