PRB: Updating Memvars When Checking Spelling of Edit Fields

ID: Q109610

2.50 2.50a 2.50b 3.00| 2.50b

WINDOWS              | MACINTOSH
  kbprb

The information in this article applies to:

SYMPTOMS

If a memo field is opened within a program using the MODIFY MEMO command with the NOWAIT clause, the spelling checker can be used to update the spelling of words within the memo field. But before the updated contents of that memo field can be used to update a memory variable, the window opened with the MODIFY MEMO command must be released. This situation normally occurs when the SCATTER MEMVAR MEMO command is used with GET fields in a screen.

MORE INFORMATION

In addition to memo fields, the spelling checker can be used to check the spelling of other text files.

Steps to Reproduce Problem

The following sample program can be used to illustrate the problem. It uses the SALESMAN database that is found in the TUTORIAL subdirectory.

   CLEAR
   CLEAR ALL
   USE salesman
   SCATTER MEMVAR MEMO BLANK
   button=0
   STORE "Delete this and type something that is misspelled" TO ;
        m.notes

   @ 0.077,0.000 SAY "Salesman" ;
        FONT "MS Sans Serif",8 ;
        STYLE "BT"
   @ 0.077,12.400 GET m.salesman ;
        SIZE 1.000,4.400 ;
        DEFAULT "" ;
        FONT "MS Sans Serif",8 ;
        PICTURE "@K"
   @ 2.231,0.000 SAY "Notes" ;
        FONT "MS Sans Serif",8 ;
        STYLE "BT"
   @ 2.231,12.400 EDIT m.notes ;
        SIZE 3.000,25.000,0.000 ;
        PICTURE "@K" ;
        DEFAULT "" ;
        FONT "MS Sans Serif",8 ;
        SCROLL STYLE "BT"
   @ 2.769,69.600 GET button ;
        PICTURE "@*VN Quit;Spell" ;
        SIZE 1.769,6.833,0.308 ;
        DEFAULT 1 ;
        FONT "MS Sans Serif",8 ;
        STYLE "BT" VALID butval()
   READ CYCLE

   SELECT salesman
   USE
   CLEAR ALL
   CLEAR

   FUNCTION butval
   DO CASE
       CASE button=1
             CLEAR READ
       CASE button=2
             CREATE TABLE vnote (result m)
             INSERT INTO vnote (result) VALUES (m.notes)
             MODIFY MEMO vnote.result NOWAIT
             DO (_spellchk)
             STORE vnote.result TO m.notes
             SHOW GETS
             WAIT WINDOW "The memo field is not updated"
             RELEASE WINDOW vnote.result
             STORE vnote.result TO m.notes
             SHOW GETS
             WAIT WINDOW "Now the memo field variable is updated"
   ENDCASE

The spelling corrections in the above program will be seen in the window named VNOTE.RESULT but not in the edit field into which the misspelled words were originally typed until the VNOTE.RESULT window is released. This behavior is necessary so that the memory variable can be updated. Since the memo is being edited NOWAIT, the editing window must be released before the VNOTE.RESULT field in the temporary table, VNOTE, is updated. The memo field needs to be edited NOWAIT so that program execution can proceed and check the spelling of the memo.

REFERENCES

FoxPro for Windows Help file

FoxPro for Windows "Language Reference," version 2.5, pages L3-31 to L3-40, L3-349 to L3-350, L3-586 to L3-587, L3-662 to L3-664, L3-851 to L3-853, L3-1023

Additional reference words: VFoxWin 3.00 FoxMac FoxWin 2.50 2.50a 2.50b

KBCategory:   kbprb
KBSubcategory: FxenvMemory
Keywords          : kbcode FxenvMemory 
Version           : 2.50 2.50a 2.50b 3.00| 2.50b
Platform          : MACINTOSH WINDOWS

Last Reviewed: May 22, 1998