Subject (no subject)
From Ivan Benttini <benttini2@gmail.com>
Date Wed, 07 Aug 2019 10:35:33 -0400
Newsgroups dbase.getting-started

//These lines below is only to be used once to create the index for the first time
//close databases
//use NA exclusive
//index on UPPER(fna) tag fna
//close databases


///////////////////////////////////////////////////////////////////////
//
//Add the following in the header section of the form above the
//** END HEADER line
///////////////////////////////////////////////////////////////////////

if type( "BringWindowToTop" ) # "FP"
    extern cLogical BringWindowToTop(cLong) user32
endif
local f
f = findinstance("NAForm") //make sure this classname is correct
if empty(f)
    //Open form if not already open
    f = new NAForm()
    f.open()
else  //restore to normal size in case it was minimised
    f.windowState = 0
    bringWindowToTop(f.hwnd)
endif
return // <--- Important! Don't leave this line (return) as per Mr Marvin and Mr Mayer

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

class NAForm of FORM
   set procedure to SEEKER.CC additive
   with (this)
      onOpen = class::FORM_ONOPEN
      colorNormal = "btnFace"
      height = 17.0
      left = 1.5714
      top = 6.2727
      width = 102.4286
      text = "My Name and Address Black BOOK"
      background = "filename dBase-Stucco.jpg"
      autoCenter = true
      mdi = false
      menuFile = "NA.mnu"
      icon = "resource #21"
   endwith

   this.NA1 = new QUERY()
   this.NA1.parent = this
   with (this.NA1)
      left = 80.4286
      top = 0.7273
      sql = 'select * from "NA.DBF"'
      active = true
   endwith

   with (this.NA1.rowset)
      indexName = "fNa"
   endwith

   this.PUSHBUTTON1 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON1)
      onClick = class::PUSHBUTTON1_ONCLICK
      height = 1.5455
      left = 3.0
      top = 8.0
      width = 15.57
      text = ""
      upBitmap = "RESOURCE #1270"
      speedTip = "Change Pictures."
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON10 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON10)
      height = 1.0
      left = 19.5
      top = 6.5
      width = 4.2857
      text = ""
      upBitmap = "RESOURCE #912"
      speedTip = "Personal eMail Address"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON8 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON8)
      height = 1.0
      left = 48.5
      top = 6.5
      width = 4.2857
      text = ""
      upBitmap = "RESOURCE #912"
      speedTip = "Work eMail Address"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON3 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON3)
      onClick = class::PUSHBUTTON3_ONCLICK
      height = 1.0
      left = 19.4286
      top = 7.5
      width = 4.0
      text = ""
      upBitmap = "RESOURCE #1270"
      speedTip = "Go to the personal Web Page"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON2 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON2)
      onClick = class::PUSHBUTTON2_ONCLICK
      height = 1.1364
      left = 19.4286
      top = 8.5
      width = 4.0
      text = ""
      upBitmap = "RESOURCE #2001"
      speedTip = "Find Record"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON4 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON4)
      onClick = class::PUSHBUTTON4_ONCLICK
      height = 1.5
      left = 54.8571
      top = 0.7273
      width = 5.4286
      text = ""
      upBitmap = "RESOURCE TL_FIRST"
      speedTip = "First record"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON5 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON5)
      onClick = class::PUSHBUTTON5_ONCLICK
      height = 1.5
      left = 60.5714
      top = 0.7273
      width = 5.4286
      text = ""
      upBitmap = "RESOURCE TL_PREV"
      speedTip = "Previous record"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON6 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON6)
      onClick = class::PUSHBUTTON6_ONCLICK
      height = 1.5
      left = 66.2857
      top = 0.7273
      width = 5.4286
      text = ""
      upBitmap = "RESOURCE TL_NEXT"
      speedTip = "Next record"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON7 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON7)
      onClick = class::PUSHBUTTON7_ONCLICK
      height = 1.5
      left = 72.0
      top = 0.7273
      width = 5.4286
      text = ""
      upBitmap = "RESOURCE TL_LAST"
      speedTip = "Last record"
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD1 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD1)
      dataLink = form.na1.rowset.fields["fna"]
      height = 1.0
      left = 19.4286
      top = 2.5
      width = 19.0
      fontBold = true
      fontUnderline = true
      speedTip = "First Name"
      borderStyle = 8        // Modal
   endwith

   this.IMAGE1 = new IMAGE(this)
   with (this.IMAGE1)
      height = 7.2727
      left = 3.0
      top = 0.7273
      width = 15.5714
      dataSource = form.na1.rowset.fields["photo"]
      borderStyle = 8        // Modal
      speedTip = "Last picture taken"
   endwith

   this.ENTRYFIELD2 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD2)
      dataLink = form.na1.rowset.fields["mini"]
      height = 1.0
      left = 38.4286
      top = 2.5
      width = 5.0
      speedTip = "Middle Name"
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD3 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD3)
      dataLink = form.na1.rowset.fields["lna"]
      height = 1.0
      left = 43.4286
      top = 2.5
      width = 34.0
      speedTip = "Last Name"
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD4 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD4)
      dataLink = form.na1.rowset.fields["addr1"]
      height = 1.0
      left = 19.4286
      top = 3.5
      width = 58.0
      speedTip = "Home Address"
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD5 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD5)
      dataLink = form.na1.rowset.fields["city1"]
      height = 1.0
      left = 19.4286
      top = 4.5
      width = 29.0
      speedTip = "City"
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD6 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD6)
      height = 1.0
      left = 48.4286
      top = 4.5
      width = 6.0
      speedTip = "State"
      value = "          "
      maxLength = 10
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD7 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD7)
      height = 1.0
      left = 54.4286
      top = 4.5
      width = 23.0
      speedTip = "Zip Code"
      value = ""
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD8 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD8)
      height = 1.0
      left = 19.4286
      top = 5.5
      width = 29.0
      speedTip = "Telephone 1"
      value = ""
      helpID = "Telephone One"
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD9 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD9)
      height = 1.0
      left = 48.4286
      top = 5.5
      width = 29.0
      speedTip = "Telephone 2"
      value = ""
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD10 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD10)
      height = 1.0
      left = 23.5
      top = 6.5
      width = 25.0
      speedTip = "Personal eMail"
      value = ""
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD11 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD11)
      height = 1.0
      left = 52.8571
      top = 6.5
      width = 24.5714
      speedTip = "Job eMail"
      value = ""
      borderStyle = 8        // Modal
   endwith

   this.SEEKER1 = new SEEKER(this)
   with (this.SEEKER1)
      onOpen = class::SEEKER1_ONOPEN
      height = 1.0909
      left = 23.4286
      top = 8.5
      width = 54.0
      speedTip = "Using SEEKER find anyone on the Table NA.dbf"
      borderStyle = 8        // Modal
   endwith

   this.ENTRYFIELD12 = new ENTRYFIELD(this)
   with (this.ENTRYFIELD12)
      dataLink = form.na1.rowset.fields["pwebpg"]
      height = 1.0
      left = 23.4286
      top = 7.5
      width = 54.0
      speedTip = "Personal Web page"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON9 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON9)
      onClick = class::PUSHBUTTON9_ONCLICK
      height = 1.5
      left = 19.5
      top = 0.7273
      width = 5.4286
      text = ""
      upBitmap = "RESOURCE TL_FIRST"
      speedTip = "First record"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON11 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON11)
      onClick = class::PUSHBUTTON11_ONCLICK
      height = 1.5
      left = 25.5
      top = 0.7273
      width = 5.4286
      text = ""
      upBitmap = "RESOURCE TL_PREV"
      speedTip = "Previous record"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON12 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON12)
      onClick = class::PUSHBUTTON12_ONCLICK
      height = 1.5
      left = 31.4286
      top = 0.7273
      width = 5.4286
      text = ""
      upBitmap = "RESOURCE TL_NEXT"
      speedTip = "Next record"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON13 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON13)
      onClick = class::PUSHBUTTON13_ONCLICK
      height = 1.5
      left = 37.5
      top = 0.7273
      width = 5.4286
      text = ""
      upBitmap = "RESOURCE TL_LAST"
      speedTip = "Last record"
      borderStyle = 8        // Modal
   endwith

   this.PUSHBUTTON14 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON14)
      onClick = class::PUSHBUTTON14_ONCLICK
      height = 1.5
      left = 7.0
      top = 12.0
      width = 16.2857
      text = "FIRST"
      upBitmap = "RESOURCE TL_FIRST"
      fontBold = true
      fontItalic = true
      fontUnderline = true
      speedTip = "FIRST Record"
      borderStyle = 8        // Modal
      colorNormal = "red/BtnFace"
   endwith

   this.PUSHBUTTON15 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON15)
      onClick = class::PUSHBUTTON15_ONCLICK
      height = 1.5
      left = 23.4286
      top = 12.0
      width = 16.2857
      text = "PREVIOUS"
      upBitmap = "RESOURCE TL_PREV"
      fontBold = true
      speedTip = "PREVIOUS Record"
      borderStyle = 8        // Modal
      colorNormal = "BLUE/BtnFace"
   endwith

   this.PUSHBUTTON16 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON16)
      onClick = class::PUSHBUTTON16_ONCLICK
      height = 1.5
      left = 40.0
      top = 12.0
      width = 16.2857
      text = "NEXT"
      upBitmap = "RESOURCE TL_NEXT"
      fontBold = true
      speedTip = "NEXT Record"
      borderStyle = 8        // Modal
      colorNormal = "BLUE/BtnFace"
   endwith

   this.PUSHBUTTON17 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON17)
      onClick = class::PUSHBUTTON17_ONCLICK
      height = 1.5
      left = 56.4286
      top = 12.0
      width = 16.2857
      text = "LAST"
      upBitmap = "RESOURCE TL_LAST"
      fontBold = true
      fontItalic = true
      fontUnderline = true
      speedTip = "LAST Record"
      borderStyle = 8        // Modal
      colorNormal = "red/BtnFace"
   endwith

   this.PUSHBUTTON18 = new PUSHBUTTON(this)
   with (this.PUSHBUTTON18)
      onClick = class::PUSHBUTTON18_ONCLICK
      height = 1.5455
      left = 3.0
      top = 9.4545
      width = 15.5714
      text = ""
      upBitmap = "RESOURCE #1290"
      speedTip = "Special NOTES."
      borderStyle = 8        // Modal
   endwith

   this.EDITOR1 = new EDITOR(this)
   with (this.EDITOR1)
      visible = false
      height = 7.0
      left = 79.0
      top = 2.5
      width = 20.0
      dataLink = form.na1.rowset.fields["note1"]
      speedTip = "Info about the record on the VIEW."
   endwith

   this.rowset = this.na1.rowset

   /////////////////////////////

   function PUSHBUTTON11_onClick
      // Previous record
      // Lets go to the PREVIOUS record in the table or rowSet
      if not form.rowset.endOfSet
         form.rowset.next(-1)
         if form.rowset.endOfSet
            form.rowset.next()
            msgbox("You are at the begin/first record of the TABLE or rowSets")
         endif
      else
         msgbox("You are at the begin/first record of the TABLE or rowSets")
      endif
      return

   function PUSHBUTTON12_onClick
      // Next record
      // Lets go to the NEXT record in the table or rowSet
      if not form.rowset.endOfSet
         form.rowset.next()
         if form.rowset.endOfSet
            form.rowset.next(-1)
            msgbox("You are at the end/last record of the TABLE or rowSets")
         endif
      else
         msgbox("You are at the end/last record of the TABLE or rowSets")
      endif
      return

   function PUSHBUTTON13_onClick
      // Last record
      // Lets go to the LAST record in the table or rowSet
      if not form.rowset.endOfSet
         form.rowset.last()  //next(-1)
         msgbox("You are at the end/last record of the TABLE or rowSets")
         if form.rowset.endOfSet
            form.rowset.last()
            //msgbox("You are at the last of the TABLE or rowSets")
         endif
      else
      endif
      return

   function PUSHBUTTON14_onClick
      // GO TO FIRST RECORD.
      if NOT form.rowset.endOfSet
         form.rowset.FIRST()
         msgBox("You are at the FIRST record of the TABLE in USE.")
      else
      endif
      return

   function PUSHBUTTON15_onClick
      // GO TO PREVIOUS RECORD.
      if NOT form.rowset.endOfSet
         form.rowset.NEXT(-1)
         if form.rowset.endOfSet
            form.rowset.NEXT()
            msgBox("You are at the Begining/FIRST record of the TABLE in USE.")
         endif
      else
          msgBox("You are at the Begining/FIRST record of the TABLE in USE.")
      endif
      return

   function PUSHBUTTON16_onClick
      // GO TO NEXT RECORD.
      if NOT form.rowset.endOfSet
         form.rowset.NEXT()
         if form.rowset.endOfSet
            form.rowset.NEXT(-1)
            msgBox("You are at the END/Last record of the TABLE in USE.")
         endif
      else
          msgBox("You are at the END/Last record of the TABLE in USE.")
      endif
      return

   function PUSHBUTTON17_onClick
       // GO TO LAST RECORD.
      if NOT form.rowset.endOfSet
         form.rowset.LAST()
         msgBox("You are at the END/Last record of the TABLE in USE.")
         if form.rowset.endOfSet
            form.rowset.LAST()
            msgBox("You are at the END/Last record of the TABLE in USE.")
         endif
      else
          //msgBox("You are at the END/Last record of the TABLE in USE.")
      endif
      return

   function PUSHBUTTON18_onClick
      // SPECIAL NOTES ...Check to see if you have permission to Open this private INFORMATION.
      // # 4 means YES-NO  for MSGBOX() returns.  

      local cAnswer
      //cAnswer = " "
      cAnswer = msgBox("Enter special OPTION to view private information","Are you sure?",4+32)
    
      ?"Out of message box",  cAnswer
      msgbox("Previous msgbox okay"+ str(cAnswer,2,0))
      
      DO CASE
         CASE cAnswer = 6  // returning by clicking YES
              form.rowset.editor1.visible = true          // equals YES to show EDITOR1 information by it becaming visible.
              
                            
         CASE cAnswer = 7  // returning by clicking NO                                
              form.rowset.editor1.visible = false         // DO NOT show EDITOR1 content info. end continue invisible.
      ENDCASE                                             //
      return

   function PUSHBUTTON1_onClick
      // Change Picture
      local cFile
      cFile = getFile("*.*","Change Picture")
      if "" # cFile
         form.NA1.rowset.fields["photo"].replaceFromFile(cFile)
         form.NA1.rowset.SAVE()
      endif
      return

   function PUSHBUTTON2_onClick
      //Enable field 2 collect name by using SEEKER.cc
      if form.SEEKER1.visible = true
         form.SEEKER1.visible = false
         form.SEEKER1.value = ""
         form.SEEKER1.setFocus()
      else
         form.SEEKER1.visible = false
         form.SEEKER1.visible = true
         form.SEEKER1.setFocus()
      endif
      return

   function PUSHBUTTON3_onClick
      // Going to the Personal Web Page on the Internet
      if empty(form.entryfield12.value)
         msgBox("Ops! No http: domail name available at this time")
         form.entryfield12.setFocus()
       else
         set procedure to MISCAPI.prg additive
         //set procedure to :FormControls:MISCAPI.prg additive
         c = form.entryfield12.value
         OpenURL(c)
      endif
      return

   function PUSHBUTTON4_onClick
      // First record
      // Lets go to the FIRST record in the table or rowSet
      if not form.rowset.endOfSet
         form.rowset.first()
         msgbox("You are at the first record of the TABLE or rowSets")
      else
      endif
      return

   function PUSHBUTTON5_onClick
      // Previous record
      // Lets go to the PREVIOUS record in the table or rowSet
      if not form.rowset.endOfSet
         form.rowset.next(-1)
         if form.rowset.endOfSet
            form.rowset.next()
            msgbox("You are at the begin/first record of the TABLE or rowSets")
         endif
      else
         msgbox("You are at the begin/first record of the TABLE or rowSets")
      endif
      return

   function PUSHBUTTON6_onClick
      // Next record
      // Lets go to the NEXT record in the table or rowSet
      if not form.rowset.endOfSet
         form.rowset.next()
         if form.rowset.endOfSet
            form.rowset.next(-1)
            msgbox("You are at the end/last record of the TABLE or rowSets")
         endif
      else
         msgbox("You are at the end/last record of the TABLE or rowSets")
      endif
      return

   function PUSHBUTTON7_onClick
      // Last record
      // Lets go to the LAST record in the table or rowSet
      if not form.rowset.endOfSet
         form.rowset.last()  //next(-1)
         msgbox("You are at the end/last record of the TABLE or rowSets")
         if form.rowset.endOfSet
            form.rowset.last()
            //msgbox("You are at the last of the TABLE or rowSets")
         endif
      else
      endif
      return

   function PUSHBUTTON9_onClick
      // First record
      // Lets go to the FIRST record in the table or rowSet
      if not form.rowset.endOfSet
         form.rowset.first()
         msgbox("You are at the first record of the TABLE or rowSets")
      else
      endif
      return

   function SEEKER1_onOpen
      // On Form Opening Seeker1 should be NOT Visiblde or False
      form.SEEKER1.visible = False
      return

   function form_onOpen
      // On form Open OPEN the NA.menu
      //form.release() this will close the form...be carefull

      ///////////////////////////////////////////////////////////
      //SET PROCEDURE TO NA.mnu ADDITIVE
      //SET PROCEDURE TO PASSWORD.CC ADDITIVE
      ///////////////////////////////////////////////////////////
    
      //  This is a good example to ATTACH a toolBar (IVANTB.CC) to a form.
      SET PROCEDURE TO IVANTB.CC ADDITIVE
      t=new IVANTB()
      try
         t.attach(form)
         catch(exception e)
      endtry

      form.rowset.first()
      msgBox("Every time this form opens it goes to the FIRST record on the NA table.")    
      return

endclass