Modify Memo, Close Memo, Set Window Of Memo

These commands give you programmatic control over the window used for editing a memo field. We haven't used any of them much since we got the ability to edit memo fields right in a form (@ .. EDIT in FoxPro 2.x and Edit box in VFP). These aren't even all that useful interactively because it's just as easy to set things up (say, in a Browse) the way we want them with the mouse.MODIFY MEMO opens an editing window for the specified memo field. CLOSE MEMO closes the specified memo editing window. SET WINDOW OF MEMO lets you predefine a window for memo editing so it has the characteristics you want.

Usage

MODIFY MEMO MemoField1 [ , MemoField2 [ , ... ] ]
        [ NOEDIT | NOMODIFY ] [ NOMENU ] [ NOWAIT ] 
        [ RANGE nStartPos, nEndPos ]
        [ [ WINDOW DefinitionWindow ] 
          IN [ WINDOW ] ContainerWindow | IN SCREEN 
          | IN MACDESKTOP ] 
        [ SAME ]
        [ SAVE ]

Parameter

Value

Meaning

MemoFieldn

Name

A memo field for which an editing window should open.

nStartPos, nEndPos

Numeric

A range of characters in MemoFieldn, which are highlighted when the window opens.

DefinitionWindow

Name

The name of a window that provides the size, shape and characteristics for the editing window.

ContainerWindow

Name

The name of a window in which the memo editing window is placed.


We don't think we've ever used MODIFY MEMO on multiple fields at once. When you do, the memo windows all open in the same place, one on top of the other, unless you've previously opened them and moved them around. Some help!There are several different ways that the position of the editing window can be specified. The command contains two different window-related clauses—WINDOW and IN WINDOW—which serve very different roles. WINDOW specifies a defined window that serves as a template for the editing window. The memo field isn't edited in DefinitionWindow, but it draws its characteristics from that window. If you look at the Window pull-down menu after using MODIFY MEMO WINDOW, you'll see two windows listed: DefinitionWindow and the memo window itself. (In fact, you can release DefinitionWindow once you've issued MODIFY MEMO and save the memory it's using.)IN WINDOW is different. It specifies a parent or container window for the memo-editing window. The editing window is forced to stay inside ContainerWindow, which must be active for the editing window to appear. Moving the editing window beyond the bounds of ContainerWindow crops it.You can combine WINDOW and IN WINDOW in a single MODIFY MEMO to specify both a template and a container. IN SCREEN indicates that the memo-editing window should have the main Visual FoxPro window as its parent rather than a different window. This is an issue only if you've previously placed the editing window in another window.IN MACDESKTOP creates a free-floating edit window that has an entry in the taskbar and can be moved around like any app. We're not sure when you'd use this, but it is interesting.NOEDIT and its undocumented synonym, NOMODIFY, let you look, but you can't touch. (The NOMODIFY clause of the various MODIFY commands is one of our favorites because it lets us write oxymorons like MODIFY MEMO MyNote NOMODIFY. That's right up there with WAIT WINDOW MyMessage NOWAIT.)NOMENU removes the Format pad from the menu or prevents it from appearing if it wasn't already there. Use this if you don't want the user to be able to change the font (not a very nice thing to do).NOWAIT and SAVE let you open up a bunch of windows at once and then leave them open for the user. NOWAIT indicates that execution should continue once the editing window is displayed, rather than waiting for the user to close it. Supposedly, SAVE keeps the window from closing when another window is activated. It's needed in a program only when you don't use NOWAIT—in that case, it keeps your editing window alive until you close it.SAME is another clause that doesn't really seem to do much of anything. Help says it lets you display the memo-editing window without it becoming active. We see that behavior only if the window's already displayed.

Example

USE Employee
MODIFY MEMO Notes
 
* Set up the window in advance
DEFINE WINDOW NotesMemo FROM 0,0 TO 10,70 PANEL
* Don't allow changes
MODIFY MEMO Notes WINDOW NotesMemo NOMODIFY

Usage

CLOSE MEMO MemoField1 [ , MemoField2 [ , ... ] ] | ALL
CLOSE MEMO closes the editing windows for the fields listed or for all memo fields, even if they're from different tables.

Usage

SET WINDOW OF MEMO TO [ DefinitionWindow ]
This command lets you specify a predefined window to use as a template whenever a memo-editing window is opened. This window functions like the one listed in the WINDOW clause of MODIFY MEMO—it provides characteristics for the memo window. The memo is actually edited in a different window based on DefinitionWindow. The template is used both for MODIFY MEMO and for editing triggered by a user from a Browse or a grid.You can override SET WINDOW OF MEMO by including the WINDOW clause in MODIFY MEMO.To find out the current DefinitionWindow, check SET("WINDOW").

Example

* Define a memo editing template window
DEFINE WINDOW WindMemo from 0,0 TO 10,70 PANEL
SET WINDOW OF MEMO TO WindMemo
 
* Now edit some memo fields
MODIFY MEMO Employee.Notes
MODIFY MEMO Category.Description
 
* Shut them down
CLOSE MEMO ALL

See Also

Browse, EditBox


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .