** END HEADER -- do not remove this line // // Generated on 02/09/2020 // parameter bModal local f f = new customerForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class customerForm of DATAFORMCFORM from :DT_custom:dataForm.cfm set procedure to customer.dmd additive set procedure to :FormControls:seeker.cc additive set procedure to :DT_custom:MyControls.cc additive with (this) onOpen = class::FORM_ONOPEN height = 465.0 left = 559.0 top = 137.0 width = 638.0 text = "Customer form" endwith this.CUSTOMERDATAMODULE1 = new CUSTOMERDATAMODULE() this.CUSTOMERDATAMODULE1.parent = this with (this.CUSTOMERDATAMODULE1) left = 511.0 top = 396.0 width = 100.0 height = 37.0 endwith with (this.MYTITLETEXT1) text = "Customer Information" endwith with (this.MYGRID1) dataLink = form.customerdatamodule1.customer1.rowset columns["COLUMN1"] = new GRIDCOLUMN(form.MYGRID1) with (columns["COLUMN1"]) dataLink = form.customerdatamodule1.customer1.rowset.fields["last name"] editorType = 1 // EntryField width = 169.0 endwith columns["COLUMN2"] = new GRIDCOLUMN(form.MYGRID1) with (columns["COLUMN2"]) dataLink = form.customerdatamodule1.customer1.rowset.fields["first name"] editorType = 1 // EntryField width = 150.0 endwith columns["COLUMN3"] = new GRIDCOLUMN(form.MYGRID1) with (columns["COLUMN3"]) dataLink = form.customerdatamodule1.customer1.rowset.fields["city"] editorType = 1 // EntryField width = 203.0 endwith with (columns["COLUMN1"].headingControl) value = "Last Name" endwith with (columns["COLUMN2"].headingControl) value = "First Name" endwith with (columns["COLUMN3"].headingControl) value = "City" endwith endwith this.LABNAME = new MYTEXTLABEL(this) with (this.LABNAME) height = 22.0 left = 42.0 top = 101.0 width = 45.0 text = "Name:" endwith this.ENTRYFIRST = new MYENTRYFIELD(this) with (this.ENTRYFIRST) dataLink = form.customerdatamodule1.customer1.rowset.fields["first name"] height = 22.0 left = 105.0 top = 101.0 width = 112.0 endwith this.ENTRYLAST = new MYENTRYFIELD(this) with (this.ENTRYLAST) dataLink = form.customerdatamodule1.customer1.rowset.fields["last name"] height = 22.0 left = 231.0 top = 101.0 width = 168.0 endwith this.LABADDRESS = new MYTEXTLABEL(this) with (this.LABADDRESS) height = 22.0 left = 28.0 top = 132.0 width = 59.0 text = "Address:" endwith this.ENTRYSTREET1 = new MYENTRYFIELD(this) with (this.ENTRYSTREET1) dataLink = form.customerdatamodule1.customer1.rowset.fields["street1"] height = 22.0 left = 105.0 top = 132.0 width = 217.0 endwith this.ENTRYSTREET2 = new MYENTRYFIELD(this) with (this.ENTRYSTREET2) dataLink = form.customerdatamodule1.customer1.rowset.fields["street2"] height = 22.0 left = 105.0 top = 154.0 width = 217.0 endwith this.ENTRYCITY = new MYENTRYFIELD(this) with (this.ENTRYCITY) dataLink = form.customerdatamodule1.customer1.rowset.fields["city"] height = 22.0 left = 105.0 top = 190.0 width = 135.0 endwith this.MYENTRYFIELD6 = new MYENTRYFIELD(this) with (this.MYENTRYFIELD6) dataLink = form.customerdatamodule1.customer1.rowset.fields["postal"] height = 22.0 left = 385.0 top = 190.0 width = 70.0 endwith this.COMBOSTATE = new MYCOMBOBOX(this) with (this.COMBOSTATE) dataLink = form.customerdatamodule1.customer1.rowset.fields["state id"] height = 22.0 left = 243.0 top = 190.0 width = 121.0 endwith this.COMBOCTY = new MYCOMBOBOX(this) with (this.COMBOCTY) dataLink = form.customerdatamodule1.customer1.rowset.fields["country id"] height = 22.0 left = 469.0 top = 190.0 width = 154.0 endwith this.LABCITY = new MYTEXTLABEL(this) with (this.LABCITY) height = 22.0 left = 55.0 top = 190.0 width = 35.0 text = "City:" endwith this.LABPHONE = new MYTEXTLABEL(this) with (this.LABPHONE) height = 22.0 left = 40.0 top = 226.0 width = 50.0 text = "Phone:" endwith this.LABCOMMENT = new MYTEXTLABEL(this) with (this.LABCOMMENT) height = 22.0 left = 12.0 top = 265.0 width = 78.0 text = "Comments:" endwith this.ENTRYPHONE = new MYENTRYFIELD(this) with (this.ENTRYPHONE) dataLink = form.customerdatamodule1.customer1.rowset.fields["phone"] height = 22.0 left = 105.0 top = 226.0 width = 116.0 endwith this.EDITCOMMENTS = new MYEDITOR(this) with (this.EDITCOMMENTS) height = 98.0 left = 105.0 top = 265.0 width = 371.0 dataLink = form.customerdatamodule1.customer1.rowset.fields["comments"] endwith this.rowset = this.customerdatamodule1.customer1.rowset function form_onOpen() public oForm oForm=form.rowset.parent.parent.parent //msgbox("super::mytoolbar1 is "+) //msgbox("This.oTop is "+this.oTop.baseclassname) //this.oTop=this.mytoolbar1 if form.rowset # null // don't allow automatic editing form.rowset.autoEdit := false // assign this method to the rowset's canNavigate: form.rowset.canNavigate := class::rowset_canNavigate form.rowset.canSave := class::rowset_cansave // go to the first row ... form.rowset.first() endif function rowset_canNavigate() local bYes, nAnswer if type("_app.cancelNav") == "L" and _app.cancelNav _app.cancelNav := null bYes = false else bYes = true if this.modified nAnswer = msgbox("Save changes before leaving record?",; "Data has changed",32+3) do case case nAnswer == 6 // Yes bYes = true if not this.canSave() _app.cancelNav = true bYes = false else this.save() _app.cancelNav = true endif case nAnswer == 7 // No this.abandon() // abandon changes but stay on that record _app.cancelNav = true bYes = false otherwise // Cancel bYes := false _app.cancelNav = true endcase endif endif return bYes function rowset_canSave() local bRet bRet = true if type("_app.cancelNav") == "L" and _app.cancelNav _app.cancelNav := null bRet = false else bRet = true if this.modified cStr="|"+rtrim(this.parent.parent.parent.combocty.value)+"|" cStr2="|"+rtrim(this.parent.parent.parent.combostate.value)+"|" if this.state=="2" //if editing the row, country is a code // TO-DO: this doesn't cover cases where the user may // accidentally change the country, in that scenario, //the country would be morphed too... //msgbox("edit mode") if cStr$"|US|AU|" if empty(this.fields["state id"].value) msgbox("The state ID cannot be empty for country "+; this.fields["country id"].value,"Alert",64) this.abandon() bRet = false endif endif elseif this.state=="3" //if appending a row, country is morphed if cStr $ "|United States|Australia|" if empty(this.fields["state id"].value) msgbox("The state ID cannot be empty for country "+; this.fields["country id"].value,"Alert",64) bRet = false endif endif endif endif endif if bRet=true msgbox("type of oForm is "+type("oForm")+", baseclass is "+oForm.baseclassname) //oForm.mytoolbox1.resetToolbar() //the above addressing doesn't work this.parent.parent.parent.mytoolbar1.resettoolbar() // the above addressing works endif return bRet endclass