Subject Re: Forms Processing Text Box buffer to Data Fields
From Mervyn Bick <invalid@invalid.invalid>
Date Fri, 12 Sep 2014 19:57:50 +0200
Newsgroups dbase.getting-started

On Fri, 12 Sep 2014 19:07:49 +0200, Eric Logan <jelogan@eltopia.com> wrote:

> Mervyn;
> I tried your sample app.
> I encountered errors and had to comment out some lines in  
> master_edit.wfm to make it work.
>
> Error. Not a member of class or base class.
> ENTRYFIELD1_ONOPEN
> File: master_edit.wfm
> Routine: Master_editForm::masteredit_form
> Line: 68
>
> I noticed there are no procedures for ENTRYFIELD1_ONOPEN,  
> ENTRYFIELD2_ONOPEN, or ENTRYFIELD3_ONOPEN
> I commented out lines 68, 79 and 89. Then the app worked OK.
> For me, in 2.8 the error allowed closing the form. But in 9.3 it caused  
> dBase to shut down. (I'm running on Win 7 64bit.)

OOPS. <blush>  That really was a silly mistake.

Mm, dBASE 8, and now dBASE 9, don't seem to handle errors as elegantly as  
earlier versions.  Errors happen and it's important that dBASE should  
handle them elegantly and not simply shut down in a sulk. <g>

I noticed the empty event handlers in the code copied into the message  
just before I pressed the Send button so I deleted them.  I DID look look  
to see if the event handlers had been assigned but obviously didn't look  
properly.   :-(

Robert, please either patch the code by commenting out the three lines as  
Eric has described or use the revised (tested! <g>) code below for  
master_edit.wfm.


Mervyn.

******** Start of revised master_edit.wfm *********
** END HEADER -- do not remove this line
//
// Generated on 2014/09/11
//
parameter bModal
local f
f = new master_editForm()
if (bModal)
    f.mdi = false // ensure not MDI
    f.readModal()
else
    f.open()
endif

class master_editForm of FORM
    with (this)
       height = 16.0
       left = 54.4286
       top = 7.9091
       width = 74.1429
       text = "Update master table"
       sysMenu = false
    endwith

    this.PUSHBUTTON1 = new PUSHBUTTON(this)
    with (this.PUSHBUTTON1)
       onClick = class::PUSHBUTTON1_ONCLICK
       height = 1.0909
       left = 2.4286
       top = 12.1364
       width = 15.2857
       text = "New"
    endwith

    this.PUSHBUTTON2 = new PUSHBUTTON(this)
    with (this.PUSHBUTTON2)
       onClick = class::PUSHBUTTON2_ONCLICK
       height = 1.0909
       left = 2.8571
       top = 10.5
       width = 15.2857
       text = "Edit"
    endwith

    this.PUSHBUTTON3 = new PUSHBUTTON(this)
    with (this.PUSHBUTTON3)
       onClick = class::PUSHBUTTON3_ONCLICK
       height = 1.0909
       left = 51.8571
       top = 10.5
       width = 15.2857
       text = "Save"
    endwith

    this.PUSHBUTTON4 = new PUSHBUTTON(this)
    with (this.PUSHBUTTON4)
       onClick = class::PUSHBUTTON4_ONCLICK
       height = 1.0909
       left = 51.8571
       top = 12.1364
       width = 15.2857
       text = "Abandon/Close"
    endwith

    this.ENTRYFIELD1 = new ENTRYFIELD(this)
    with (this.ENTRYFIELD1)
       when = {||false}
       height = 1.0
       left = 8.1429
       top = 6.4545
       width = 8.0
       value = ""
    endwith

    this.ENTRYFIELD2 = new ENTRYFIELD(this)
    with (this.ENTRYFIELD2)
       height = 1.0
       left = 21.5714
       top = 6.5
       width = 16.2857
       value = ""
    endwith

    this.ENTRYFIELD3 = new ENTRYFIELD(this)
    with (this.ENTRYFIELD3)
       height = 1.0
       left = 43.2857
       top = 6.5
       width = 20.0
       value = ""
    endwith

    this.TEXTLABEL1 = new TEXTLABEL(this)
    with (this.TEXTLABEL1)
       height = 1.0
       left = 8.1429
       top = 4.5909
       width = 12.0
       text = "custid"
    endwith

    this.TEXTLABEL2 = new TEXTLABEL(this)
    with (this.TEXTLABEL2)
       height = 1.0
       left = 21.5714
       top = 4.5909
       width = 12.0
       text = "custname"
    endwith

    this.TEXTLABEL3 = new TEXTLABEL(this)
    with (this.TEXTLABEL3)
       height = 1.0
       left = 43.2857
       top = 4.5909
       width = 12.0
       text = "custcity"
    endwith

    this.PUSHBUTTON5 = new PUSHBUTTON(this)
    with (this.PUSHBUTTON5)
       onClick = class::PUSHBUTTON5_ONCLICK
       height = 1.0909
       left = 27.2857
       top = 10.5
       width = 15.2857
       text = "Delete"
    endwith


    function PUSHBUTTON1_onClick
       form.entryfield1.datalink = null
       form.entryfield1.value = "AutoInc"
       form.parent.mbcustomer1.rowset.beginAppend()
       form.entryfield2.setfocus()
       return

    function PUSHBUTTON2_onClick
       form.parent.mbcustomer1.rowset.beginEdit()
       return

    function PUSHBUTTON3_onClick
       form.parent.mbcustomer1.rowset.save()
       form.close()
       return

    function PUSHBUTTON4_onClick
       form.parent.mbcustomer1.rowset.abandon()
       form.close()
       return

    function PUSHBUTTON5_onClick
      local cMessage
      cMessage = "Are you sure you want to delete this  
record?"+chr(13)+chr(10)
      cMessage += "All its child records will be deleted as well."
      if msgbox( cMessage, "Delete", 4) == 6
         form.parent.mbtrans1.rowset.first()
         do while not form.parent.mbtrans1.rowset.endofset
            form.parent.mbtrans1.rowset.delete()
            form.parent.mbtrans1.rowset.next()
         enddo
         form.mbcustomer1.rowset.delete()
         form.close()
       endif
       return


endclass
**** Send of revised master_edit.wfm **********


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0