Subject Re: Memry error
From Pieter van Heerden <psvh@mweb.co.za>
Date Fri, 27 Nov 2015 10:38:31 -0500
Newsgroups dbase.getting-started

Mervyn Bick Wrote:

> On 11/19/2015 11:02 AM, Pieter van Heerden wrote:
> > Dbase 10.2 under Windows 10
> >
> > Running an application built in dBase 10.2 results in a number of Memory errors.  The interesting thing is that if one clicks the "Ignore" button, then the application just carries on as if nothing has happened and it works correctly as well.  How does one prevent these memory errors from appearing?
> >
>
> What is your program doing when you get a MAV?  Does it happen every time?
>
> dBASE 10.2.1 is available as a free upgrade so you should install that
> and try again.
>
> If the problem persists you should try and create a small example
> program and then submit it as a bug report.
>
> Mervyn.
>
>
The MAV seems to surface in the following code for a base form, somewhere in the definition code.  The error refers to the first endwith line.  This error is transferred to all forms based on this base form.

class BaseCForm of FORM custom
   set procedure to mycontrols.cc additive
   with (this)
      onGotFocus = class::FORM_ONGOTFOCUS
      onLostFocus = class::FORM_ONLOSTFOCUS
      canClose = class::FORM_CANCLOSE
      metric = 6        // Pixels
      height = 342.0
      left = 142.0
      top = 357.0
      width = 496.0
      text = "Base Form"
      autoCenter = true
      menuFile = "sapwatmenu.mnu"
      escExit = false
      icon = "filename SapwatIcon.ico"
   endwith

   this.MYTITLETEXT1 = new MYTITLETEXT(this)
   with (this.MYTITLETEXT1)
      height = 33.0
      left = 0.0
      top = 0.0
      width = 494.0
      anchor = 2        // Top
      text = "BaseForm"
   endwith

   function Repaint
      parameter oForm
      if type("oForm") == "U" or empty(oForm)
         oForm = form
      endif
      if type("UpdateWindow") # "FP"
         extern CLOGICAL UpdateWindow(CHANDLE) USER32
      endif
      return UpdateWindow(oForm.hWnd)

   function form_canClose
      // Avoid closing the form in the wrong state
      // If we have arowset on the form, we  need
      // to check the state -- 2 = Edit, 3 = Append
      if form.rowset # null and;
         (form.rowset.state == 2 or form.rowset.state == 3)
         // If the row's been modified ...
         if form.rowset.modified
            nAnswer = msgbox("Save changes before leaving record?",;
               "Data has been changed", 32+3)
            // check the answer returned by clicking a button
            // in the message box
            do case
               case nAnswer == 6
                  form.rowset.save()
               case nAnswer == 7
                  form.rowset.abandon()
               otherwise
                  return false
            endcase
         endif
      endif
      return true

   function form_onClose
      this.release()
      return

   function form_onGotFocus
      // set application reference to this form:
      if type("_app.framewin") # "U"
         _app.framewin.currentForm = this
      endif
      form.repaint()
      return

   function form_onLostFocus
      // Null out application's reference to this form:
      if type("_app.frameWin.currentForm") # "U"
         _app.frameWin.currentForm := null
      endif
      return

endclass