Subject Re: pass a value from fora ONE to be read by form TWO
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Sun, 11 Aug 2019 07:45:53 -0700
Newsgroups dbase.getting-started
Attachment(s) form1.wfmform2.wfm

On 8/10/2019 1:22 PM, Ivan Benttini wrote:
> How can I pass a value from form One to be tested by form Two.
> I am running Microsoft Windows 7 and my dBase version is 2.80.
>
> I tought that by using a global variable like _app.VALUE NAME would do the trick but is not working for me. Can some one give me a "push" here?
>
> May be a snip of code would be Much appreciate when anyone have the time.
>


Note the attached two forms, form1 calls form2, passing the value in the
entryfield to the entryfield on form2. When form2 closes, the value in
the entryfield there is returned ... so you can communicate both ways.
Read the code ...


Ken

--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm



** END HEADER -- do not remove this line
//
// Generated on 08/11/2019
//
parameter bModal
local f
f = new form1Form()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class form1Form of FORM
   with (this)
      metric = 6        // Pixels
      height = 158.0
      left = 334.0
      top = 0.0
      width = 464.0
      text = ""
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 22.0
      left = 4.0
      top = 10.0
      width = 297.0
      text = "Form 1 -- pass information to Form 2"
   endwith

   this.MYENTRYFIELD = new ENTRYFIELD(this)
   with (this.MYENTRYFIELD)
      height = 22.0
      left = 18.0
      top = 45.0
      width = 175.0
      value = "Type something here"
   endwith

   this.OPEN_FORM2 = new PUSHBUTTON(this)
   with (this.OPEN_FORM2)
      onClick = class::OPEN_FORM2_ONCLICK
      height = 24.0
      left = 159.0
      top = 96.0
      width = 107.0
      text = "Open Form 2"
   endwith


   function OPEN_FORM2_onClick()
      set procedure to form2.wfm
      oF2 = new form2form()
      oF2.PassedValue = form.myentryfield.value
      oF2.mdi = false
      oF2.readModal()
      // code won't execute until form2 is closed
      form.myentryfield.value = oF2.PassedValueEF.value
      oF2.release()
      close procedure form2.wfm
   return

endclass



** END HEADER -- do not remove this line
//
// Generated on 08/11/2019
//
parameter bModal
local f
f = new form2Form()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class form2Form of FORM
   with (this)
      open = class::FORM_OPEN
      readModal = class::FORM_READMODAL
      metric = 6        // Pixels
      height = 213.0
      left = 435.0
      top = 177.0
      width = 420.0
      text = ""
   endwith

   this.TEXT1 = new TEXT(this)
   with (this.TEXT1)
      height = 33.0
      left = 17.0
      top = 6.0
      width = 288.0
      text = "Form 2 -- value passed from Form 1"
   endwith

   this.PASSEDVALUEEF = new ENTRYFIELD(this)
   with (this.PASSEDVALUEEF)
      height = 22.0
      left = 88.0
      top = 73.0
      width = 166.0
      value = "Entryfield1"
   endwith


   function form_open()
      if type( "this.PassedValue" ) # "U"
         this.PassedValueEF.value = this.PassedValue
      else
         this.PassedValueEF.value = "Nothing was passed ..."
      endif
   return FORM2FORM::open()

   function form_readModal()
      if type( "this.PassedValue" ) # "U"
         this.PassedValueEF.value = this.PassedValue
      else
         this.PassedValueEF.value = "Nothing was passed ..."
      endif
   return FORM2FORM::readModal()

   endclass