** END HEADER -- do not remove this line class dataFormCForm of BASECFORM custom from :DT_custom:Base.cfm set procedure to :FormControls:seeker.cc additive set procedure to :DT_custom:mycontrols.cc additive with (this) onOpen = class::FORM_ONOPEN height = 473.0 left = 247.0 top = 163.0 width = 619.0 escExit = false endwith with (this.MYTITLETEXT1) text = "DataForm" endwith this.MYTABBOX1 = new MYTABBOX(this) with (this.MYTABBOX1) height = 22.0 left = 0.0 top = 449.0 width = 617.0 endwith this.SEEKER1 = new SEEKER(this) with (this.SEEKER1) height = 22.0 left = 70.0 top = 33.0 width = 525.0 pageno = 2 endwith this.MYTEXTLABEL1 = new MYTEXTLABEL(this) with (this.MYTEXTLABEL1) height = 22.0 left = 28.0 top = 33.0 width = 35.0 text = "Find:" pageno = 2 endwith this.MYGRID1 = new MYGRID(this) with (this.MYGRID1) pageno = 2 height = 363.0 left = 28.0 top = 66.0 width = 567.0 endwith this.MYTOOLBAR1 = new MYTOOLBAR(this) with (this.MYTOOLBAR1) left = 99.0 top = 35.0 width = 429.0 height = 37.0 endwith function form_onOpen() 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 // go to the first row ... form.rowset.first() endif return function rowset_canNavigate() /* Check to save any changes before allowing navigation. For whatever reason, this gets called twice. If the user chooses Yes to Save, or No to abandon, then the next time through the rowset.modified property is false so there's no problem. If the user chooses to cancel the navigation, they'll get prompted twice. For that reason, we set a flag to indicate it's been here once. If the flag exists, we null it, if not we run the validation. BIG Note: If a future version of dBASE™ PLUS corrects the behavior so the canNavigate routine does NOT fire twice, this code will not work correctly. Applies to all dBASE builds through dBASE™ PLUS. Code by Gary White */ 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 this.save() case nAnswer == 7 // No this.abandon() otherwise // Cancel bYes := false _app.cancelNav = true endcase endif endif return bYes function resetToolbar this.mytoolbar1.pbabandon.enabled=true this.mytoolbar1.pbsave.enabled=true this.mytoolbar1.pbdelete.enabled=true this.mytoolbar1.pbnext.enabled=true this.mytoolbar1.pbprevious.enabled=true this.mytoolbar1.pbedit.enabled=true this.mytoolbar1.pbnew.enabled=true endclass