** END HEADER -- do not remove this line // // Generated on 05/03/2023 // parameter bModal local f f = new lookup_testForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class lookup_testForm of FORM with (this) onOpen = class::FORM_ONOPEN height = 22.3182 left = 26.5714 top = -0.8182 width = 64.7143 text = "" endwith this.DATABASE1 = new DATABASE(this) with (this.DATABASE1) left = 36.0 top = 3.0 width = 7.0 height = 1.0 databaseName = "MYDATA" active = true endwith this.INS_LOOKUP1 = new QUERY(this) with (this.INS_LOOKUP1) left = 36.0 width = 9.0 height = 1.0 sql = "select * from ins_info.dbf where ins_code=upper(:ins_code)" params["ins_code"] = "" active = true endwith this.ENTRYFIELD2 = new ENTRYFIELD(this) with (this.ENTRYFIELD2) when = {||false} height = 1.0 left = 18.0 top = 6.3636 width = 40.0 fontSize = 12.0 value = "" endwith this.TEXT1 = new TEXT(this) with (this.TEXT1) height = 0.7727 left = 3.1429 top = 4.9545 width = 10.8571 text = "Enter Ins ID " endwith this.ENTRYFIELD1 = new ENTRYFIELD(this) with (this.ENTRYFIELD1) onKey = class::ENTRYFIELD1_ONKEY height = 1.0 left = 4.4286 top = 6.4545 width = 8.0 picture = "!!" fontSize = 12.0 value = " " maxLength = 2 endwith this.ENTRYFIELD3 = new ENTRYFIELD(this) with (this.ENTRYFIELD3) height = 1.0 left = 4.4286 top = 9.0455 width = 25.7143 value = "dummy to accept focus" endwith this.TEXT2 = new TEXT(this) with (this.TEXT2) height = 1.7273 left = 5.0 top = 11.1818 width = 48.4286 text = "Entering a valid two character stateID will look up the State name and dispay it in entryfield2." endwith this.TEXT3 = new TEXT(this) with (this.TEXT3) height = 1.5 left = 5.0 top = 13.2727 width = 48.1429 text = "Entryfield2 can never receive focus as its WHEN event handler has been set {||false}" endwith this.TEXT4 = new TEXT(this) with (this.TEXT4) height = 2.2727 left = 5.0 top = 16.1818 width = 48.1429 text = "A valid stateId will lookup the State name and display it in entryfield2. Focus will move to the next object in the z_order." endwith this.TEXT5 = new TEXT(this) with (this.TEXT5) height = 1.5 left = 5.0 top = 19.2273 width = 48.1429 text = "An invalid stateID will blank the entry in entryfield1 and wait for a new value." endwith this.TEXT6 = new TEXT(this) with (this.TEXT6) height = 1.5 left = 4.2857 top = 0.6818 width = 30.7143 text = "Mimic the DML LOOKUP() function in OODML" endwith function ENTRYFIELD1_OnKey(nChar, nPosition,bShift,bControl) if len(TRIM(this.value)) >1 // Two characters entered form.INS_LOOKUP1.params['ins_code'] = this.value //pass value in entryfield to query parameter form.INS_LOOKUP1.requery() // fetch state name for the given stateID //Test to see if a valid stateID was entered if form.INS_lookup1.rowset.count() = 1 //found the state form.entryfield2.value = form.Ins_lookup1.rowset.fields['ins_name'].value this.before.setfocus() //Move focus to next object in z-order else // stateId not found form.entryfield2.value = 'Invalid INS Code' form.entryfield1.value = '' //Empty entryfield form.entryfield1.setfocus() //Back to entryfield to try again endif endif return function form_onOpen() form.entryfield1.setfocus() return endclass