FoxPro/VFP Grid


How can I pause program execution while this grid is open:

  PUBLIC oForm

  oForm= CREATEOBJECT('clsmultigrid')

  WITH oForm.Grid1
      .COLUMNCOUNT = 15
      .HEIGHT = 900
      .PANEL = 1
      .WIDTH = 1700
      .LEFT = 24
      .TOP = 24
      .Column1.WIDTH = 70
      .Column1.NAME = "Column1"
      .Column1.Header1.CAPTION = "Chart"
      .Column2.WIDTH = 60
      .Column2.NAME = "Column2"
      .Column2.Header1.CAPTION = "DOS"
      .Column2.FORMAT = "R"
      .Column2.INPUTMASK = "##/##/##"
      .Column3.WIDTH = 40
      .Column3.NAME = "Column3"
      .Column3.Header1.CAPTION = "Prov"
      .Column4.WIDTH = 28
      .Column4.NAME = "Column4"
      .Column4.Header1.CAPTION = "Post"
      .Column4.Check1.VISIBLE = .T.
      .Column4.CURRENTCONTROL = 'Check1'
      .Column4.Text1.VISIBLE = .F.
      .Column4.SPARSE = .F.

      .Column5.WIDTH = 60
      .Column5.NAME = "Column5"
      .Column5.Header1.CAPTION = "Proc"
      *.Column5.FORMAT = "R"
      .Column6.WIDTH = 40
      .Column6.NAME = "Column6"
      .Column6.Header1.CAPTION = "Mod1"
      .Column7.WIDTH = 40
      .Column7.NAME = "Column7"
      .Column7.Header1.CAPTION = "Mod2"
      .Column8.WIDTH = 40
      .Column8.NAME = "Column8"
      .Column8.Header1.CAPTION = "Units"

      .Column9.WIDTH = 60
      .Column9.NAME = "Column9"
      .Column9.Header1.CAPTION = "Diag1"
      .Column10.WIDTH = 75
      .Column10.NAME = "Column10"
      .Column10.Header1.CAPTION = "Diag 2"
      .Column11.WIDTH = 75
      .Column11.NAME = "Column11"
      .Column11.Header1.CAPTION = "Diag 3"

      .Column12.WIDTH = 75
      .Column12.NAME = "Column12"
      .Column12.Header1.CAPTION = "Diag 4"
      .Column13.WIDTH = 40
      .Column13.NAME = "Column13"
      .Column13.Header1.CAPTION = "Price"
      .Column14.WIDTH = 60
      .Column14.NAME = "Column14"
      .Column14.Header1.CAPTION = "Case #"
      .Column15.WIDTH = 60
      .Column15.NAME = "Column15"
      .Column15.Header1.CAPTION = "Ins1"
      .SETALL('DynamicBackColor', 'IIF(incoming.checker, RGB(200,250,200), RGB(255,255,255))', 'COLUMN')
      .VISIBLE = .T.

  oForm.VISIBLE = .T.    && this is what puts up the grid

  ON KEY LABEL esc oForm.VISIBLE = .F.
  ON KEY LABEL esc resume

  ?"End of procedure grid"
  DEFINE CLASS clsmultigrid AS FORM
      TOP = 0
      LEFT = 90
      HEIGHT = 900  &&IIF(RECCOUNT()>50,SROWS(),RECCOUNT()*8)
      WIDTH = 900 &&  376
      DOCREATE = .T.
      CAPTION = "Incoming Encounters (for Review)"
      WINDOWTYPE = 1  && 1 - Modal. No other forms can become active and the menu can be active. All forms in the form set are active.
      NAME = "clsmultigrid"
      icon= ''

      HEIGHT = 17
      WIDTH = 18
      AUTOSIZE = .f.
      CAPTION = ""
      NAME = "clscheck"

      IF checker
         WAIT WINDOW "Posting "+chart
         * if this was last procedure for this chart/dos, then Post_chosen_procedures()  && insert into MWTRN for checker
         * user should not click POST until all procedures for this encounter have been reviewed and approved
         * then, clicking on any one of them will post that whole encounter
         IF DODEFAULT()

Hi, Peter.  
Welcome back.

Without doing any actual research, I know of 3 ways to stop a program from proceeding without terminating the program.

Which one suits you best will depend on why you want the program to stop.

1 A simple programmed pause:

If you just want to stop something from continuing, you can force a pause by using:
This will cause the program to stop until a key is pressed, but control is still within the program.  
(It works, but I grant it's not very useful.  The other 2 are more flexible.)

2 A pause which allows actions outside of program control:

The easiest way to stop program control is with the SUSPEND command.  When the command is encountered, program control is returned to the development environment and the COMMAND window becomes accessible.  With the COMMAND window available, you can check the system status, the content of variables, etc.  Restore program control by typing RESUME in the COMMAND window.  The only drawback to this command is that it will not work if the program is compiled to an EXE, then it acts the same as CANCEL.

3 If you are trying to find a problem within your code:

Insert the following command at the beginning of the section of code you want to check
This will open the DEBUGGING system.  From there, you can execute your program a line at a time to check the content of variables, the status of tables, etc.
At the end of the suspect code segment,
  SET STEP OFF (to close the DEBUGGING system and return full control to the program)
If you are searching for a problem and you find one, you can also CANCEL the program from the COMMAND window.  I'm not sure it will work from within an EXE.  Even if it will work from an EXE, this process requires the development environment, so it won't work on any PC that doesn't have VFP9 installed.  

Good Luck,



All Answers

Answers by Expert:

Ask Experts


Fred Frase


Questions about development only. No installation or hardware specific questions, please. Your first step in requesting assistance should be to identify the version of FoxPro you are using. I can write short functions but, PLEASE do not ask me to write programs for you.


Nearly 30 years professional programming experience using FoxPro (FoxBase through VFP 9) or other xbase language, primarily in Windows environments.

Completed a 1,000 hour diploma course in programming at International Academy of Ohio (subsequently merged with Southern Ohio College).

©2017 All rights reserved.