Subject Re: Display Memory vars
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 3 Oct 2021 12:47:38 +0200
Newsgroups dbase.getting-started
Attachment(s) show_memVars.wfmshow_memvars1.wfm

On 2021/10/02 17:02, Akshat Kapoor wrote:
> Good Evening Russ,
>
>> In dbase you can type display memory and get a list of the vars.
>> In a running exe how can you check to see if any of vars still remain
>> after you run a function that has used private or public vars
>>
>
> display memory
> will display memory variables along with their status local/private/public
>
> While this works very well within ide while running an exe a slightly
> different version is required
>
> display memory to memory.txt

If you want to save the details to a text file one would rather use LIST
memory to memory.txt as this doesn't pause for user input between blocks
of data.

As an executable doesn't display output in the IDE Russ will probably
want some way of viewing the output without leaving the application.

Two little example forms are attached.

To create the executable

    build show_memvars.wfo,show_memvars1.wfo to show_memvars

Mervyn.



clear
** END HEADER -- do not remove this line
//
// Generated on 2021-10-03
//
parameter bModal
local f
f = new show_memVarsForm()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class show_memVarsForm of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      height = 16.0
      left = 38.1429
      top = 2.1364
      width = 55.7143
      text = ""
   endwith


   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.0909
      left = 17.7143
      top = 13.5
      width = 15.2857
      text = "Show variables"
   endwith

   function save_memvars
      form.showmem.editor1.datalink  = ''
      local c
      a = 'test'
      b = 1234.56
      c = 'local test'
      f = new file()
      if f.exists('memory.txt')
         f.delete('memory.txt')
      endif
      f.close()
      list memory to memory.txt
      return

   function PUSHBUTTON1_onClick()
      form.save_memvars()
      _app.executeMessages()
      form.showmem.mdi = false    
      form.showmem.editor1.datalink = "file memory.txt"
      form.showmem.readModal()
      return

   function form_onOpen()
      _app.allowYieldOnMsg := true
      public d
      d = 'public variable'
      set procedure to show_memvars1.wfo
      form.showmem = new show_memvars1form()
      form.pushbutton1.setFocus()
      return

endclass



clear
** END HEADER -- do not remove this line
//
// Generated on 2021-10-03
//
parameter bModal
local f
f = new show_memVars1Form()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class show_memVars1Form of FORM
   with (this)
      height = 16.0
      left = 41.2857
      top = 2.8182
      width = 114.7143
      text = ""
   endwith

   this.EDITOR1 = new EDITOR(this)
   with (this.EDITOR1)
      height = 13.2727
      left = 3.2857
      top = 1.0455
      width = 106.8571
      fontName = "Courier New"
      dataLink = "FILE memory.txt"
   endwith


endclass