if file('enter_data.dbf') // drop table enter_data endif if not file('enter_data.dbf') create table enter_data (id autoinc,street character(25),town character(25),; zip character(10)) endif ** END HEADER -- do not remove this line // // Generated on 2021-10-25 // parameter bModal local f f = new enter_dataForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class enter_dataForm of FORM with (this) onOpen = class::FORM_ONOPEN height = 16.0 left = 34.0 top = 0.1364 width = 113.1429 text = "" endwith this.ENTER_DATA1 = new QUERY(this) with (this.ENTER_DATA1) left = 3.0 width = 9.0 height = 1.0 sql = 'select * from "enter_data.DBF"' active = true endwith this.ENTRYFIELDSTREET1 = new ENTRYFIELD(this) with (this.ENTRYFIELDSTREET1) when = {||false} dataLink = form.enter_data1.rowset.fields["street"] height = 1.0 left = 63.8571 top = 9.1364 width = 27.0 endwith this.ENTRYFIELDTOWN1 = new ENTRYFIELD(this) with (this.ENTRYFIELDTOWN1) when = {||false} dataLink = form.enter_data1.rowset.fields["town"] height = 1.0 left = 63.8571 top = 11.1818 width = 27.0 endwith this.ENTRYFIELDZIP1 = new ENTRYFIELD(this) with (this.ENTRYFIELDZIP1) onKey = class::ENTRYFIELDZIP1_ONKEY when = {||false} dataLink = form.enter_data1.rowset.fields["zip"] height = 1.0 left = 63.8571 top = 13.3182 width = 12.0 endwith this.TEXTLABEL1 = new TEXTLABEL(this) with (this.TEXTLABEL1) height = 1.0 left = 47.2857 top = 9.1364 width = 12.0 text = "Street" endwith this.TEXTLABEL2 = new TEXTLABEL(this) with (this.TEXTLABEL2) height = 1.0 left = 47.2857 top = 11.3182 width = 12.0 text = "Town" endwith this.TEXTLABEL3 = new TEXTLABEL(this) with (this.TEXTLABEL3) height = 1.0 left = 47.2857 top = 13.5 width = 12.0 text = "Zipcode" endwith this.GRID1 = new GRID(this) with (this.GRID1) dataLink = form.enter_data1.rowset allowEditing = false height = 6.5 left = 4.0 top = 1.9091 width = 105.8571 endwith this.PUSHBUTTON1 = new PUSHBUTTON(this) with (this.PUSHBUTTON1) onClick = class::PUSHBUTTON1_ONCLICK height = 1.0909 left = 12.2857 top = 9.8636 width = 15.2857 text = "Start data entry" endwith this.PUSHBUTTON2 = new PUSHBUTTON(this) with (this.PUSHBUTTON2) onClick = class::PUSHBUTTON2_ONCLICK height = 1.0909 left = 12.0 top = 12.8636 width = 15.2857 text = "End data entry" endwith this.rowset = this.enter_data1.rowset function ENTRYFIELDZIP1_onKey(nChar, nPosition,bShift,bControl) if nChar = 9 //With cuaenter OFF pressing the enter key returns 9 instead of 13 form.enter_data1.rowset.save() form.enter_data1.rowset.beginAppend() form.entryfieldstreet1.setFocus() endif return function PUSHBUTTON1_onClick() set cuaenter off //Enter key act as Tab. form.enter_data1.rowset.beginAppend() //Add new blank record form.entryfieldstreet1.when = {||true} //Allow entryfeld to accept focus form.entryfieldtown1.when = {||true} form.entryfieldzip1.when = {||true} //Set entryfield daalink properties form.entryfieldstreet1.datalink = form.enter_data1.rowset.fields["street"] form.entryfieldtown1.datalink = form.enter_data1.rowset.fields["town"] form.entryfieldzip1.datalink = form.enter_data1.rowset.fields["zip"] form.entryfieldstreet1.setFocus() return function PUSHBUTTON2_onClick() set cuaenter on //Enter key does not act as tab form.entryfieldstreet1.when = {||false} //Don't allow entryfeld to accept focus form.entryfieldtown1.when = {||false} form.entryfieldzip1.when = {||false} //Disconnect entryfield datalinks form.entryfieldstreet1.datalink = '' form.entryfieldtown1.datalink = '' form.entryfieldzip1.datalink = '' if empty(form.entryfieldstreet1.value) ; or empty(form.entryfieldtown1.value) ; or empty(form.entryfieldzip1.value) // Incomplete or empty record form.enter_data1.rowset.abandon() //Delete unused blank record endif return function form_onOpen() //Disconnect entryfield datalinks so that entryfields are blank //when the form opens. form.entryfieldstreet1.datalink = '' form.entryfieldtown1.datalink = '' form.entryfieldzip1.datalink = '' return endclass