** END HEADER -- do not remove this line // // Generated on 06/04/2023 // parameter bModal local f f = new gridtestForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class gridtestForm of FORM set procedure to editpatMervyn.wfm additive with (this) metric = 6 // Pixels height = 459.0 left = -93.0 top = 15.0 width = 926.0 text = "EDIT PATIENT DATA" autoCenter = true sizeable = false moveable = false maximize = false minimize = false endwith this.DATABASE1 = new DATABASE(this) with (this.DATABASE1) left = 728.0 top = 11.0 width = 53.0 height = 37.0 databaseName = "MYTEST" active = true endwith this.PATIENT1 = new QUERY(this) with (this.PATIENT1) onOpen = class::PATIENT1_ONOPEN left = 7.0 top = 396.0 sql = "select * from patientmervyn" active = true endwith this.TEXT1 = new TEXT(this) with (this.TEXT1) height = 30.0 left = 65.0 top = 25.0 width = 356.0 fontSize = 14.0 fontBold = true text = "Enter Patient ID or Patient Last Name" endwith this.ENTRYFIELD1 = new ENTRYFIELD(this) with (this.ENTRYFIELD1) onKey = class::ENTRYFIELD1_onKey height = 33.0 left = 64.0 top = 66.0 width = 248.0 function = "!" fontSize = 14.0 value = "" endwith this.GRID1 = new GRID(this) with (this.GRID1) dataLink = form.patient1.rowset columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1) with (columns["COLUMN1"]) dataLink = form.patient1.rowset.fields["pat_no"] editorType = 1 // EntryField width = 70.0 endwith columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1) with (columns["COLUMN2"]) dataLink = form.patient1.rowset.fields["lname"] editorType = 1 // EntryField width = 150.0 endwith columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1) with (columns["COLUMN3"]) dataLink = form.patient1.rowset.fields["fname"] editorType = 1 // EntryField width = 150.0 endwith columns["COLUMN4"] = new GRIDCOLUMN(form.GRID1) with (columns["COLUMN4"]) dataLink = form.patient1.rowset.fields["addr2"] editorType = 1 // EntryField width = 199.0 endwith columns["COLUMN5"] = new GRIDCOLUMN(form.GRID1) with (columns["COLUMN5"]) dataLink = form.patient1.rowset.fields["dob"] editorType = 1 // EntryField width = 120.0 endwith with (columns["COLUMN1"].headingControl) value = "Patient #" endwith with (columns["COLUMN2"].headingControl) value = "Last Name" endwith with (columns["COLUMN3"].headingControl) value = "First Name" endwith with (columns["COLUMN4"].headingControl) value = "Address" endwith with (columns["COLUMN5"].headingControl) value = "DOB" endwith cellHeight = 22.0 rowSelect = true allowRowSizing = false allowColumnSizing = false allowColumnMoving = false allowEditing = false allowAddRows = false visible = false height = 297.0 left = 21.0 top = 110.0 width = 707.0 endwith this.PBSEARCH = new PUSHBUTTON(this) with (this.PBSEARCH) onClick = class::PBSEARCH_ONCLICK height = 39.0 left = 750.0 top = 77.0 width = 107.0 text = "SEARCH" fontSize = 12.0 fontBold = true endwith this.PBGOEDIT = new PUSHBUTTON(this) with (this.PBGOEDIT) onClick = class::PBGOEDIT_ONCLICK visible = false height = 39.0 left = 750.0 top = 133.0 width = 107.0 text = "GO TO" fontSize = 12.0 fontBold = true endwith this.PBQUIT = new PUSHBUTTON(this) with (this.PBQUIT) onClick = class::PBQUIT_ONCLICK height = 39.0 left = 750.0 top = 214.0 width = 107.0 text = "QUIT" fontSize = 12.0 fontBold = true endwith this.rowset = this.patient1.rowset function PBSEARCH_onclick() if ISBLANK(form.ENTRYFIELD1.value) //play sound filename chord.wav msgbox("Can't search without an entry.","NOTE",0) FORM.ENTRYFIELD1.setfocus() else if isalpha(form.ENTRYFIELD1.value) form.patient1.rowset.indexName := "upboth" else form.patient1.rowset.indexName := "pat_no" endif if not form.patient1.rowset.FINDKEY(form.ENTRYFIELD1.value) form.ENTRYFIELD1.value="" form.grid1.visible:= false //play sound filename chord.wav msgbox("This patient not found","ERROR",0) form.ENTRYFIELD1.setfocus() else form.grid1.refresh() form.PBGOEDIT.visible:= true form.grid1.visible := true form.grid1.setfocus() endif endif return function PATIENT1_onOpen set procedure to editpatMervyn.wfm form.editpatMervyn = new editpatMervynForm() form.editpatMervyn.parent = form //Open path back to gridtest //to editpatMervyn to facilitate requery(). return function ENTRYFIELD1_onKey(nChar, nPosition,bShift,bControl) local cVal if len(this.value) <> 0 //Avoid error if entryfield is cleared //If Enter or Tab press, execute the function pbedit_onClick if nChar = 13 or nChar = 9 form.PBGoEdit_onClick() endif //Check first character and set appropriate index if nPosition = 2 and not isAlpha(this.value) form.PATIENT1.rowset.indexname = 'pat_no' endif if nPosition = 2 and isAlpha(this.value) form.PATIENT1.rowset.indexname = 'upboth' endif //Change rowpointer //findKey() requires a variable, not an object property, //as its argument hence the use of cVal instead of this.value if isAlpha(this.value) cVal = trim(this.value) form.PATIENT1.rowset.findkey(cVal) else cVal = this.value form.Patient1.rowset.findkey(cVal) endif endif return function PBGOEDIT_onClick private cpat_no,clname store "" to cpat_no,clname //patient1 is name of main program query cpat_no = form.patient1.rowset.fields["pat_no"].value clname = form.patient1.rowset.fields["lname"].value msgbox("cpat_no: "+cpat_no) //this shows correct pat_no //query1 is name of editpatMervyn program query form.editpatMervyn.query1.rowset.findkey(cpat_no) //form.editpatMervyn.query1.requery() //clname = form.editpatMervyn.query1.rowset.fields["lname"].value msgbox("clname: "+clname) // this shows Last Name of rowset.first() //there is no change in rowset in "findkey(cpat_no)" above form.editpatMervyn.mdi = false form.editpatMervyn.readmodal() return function PBQUIT_onClick() form.patient1.active = false local f f = findinstance("editpatMervynForm") do while not empty(f) f.close() f = findinstance("editpatMervynForm",f) enddo form.editpatMervyn = null close databases form.close() return true endclass