** END HEADER -- do not remove this line // // Generated on 2022-04-27 // parameter bModal local f f = new employeesForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class employeesForm of FORM with (this) onOpen = class::FORM_ONOPEN height = 22.0455 left = 47.2857 top = 0.3182 width = 62.5714 text = "" endwith this.DBASESAMPLES1 = new DATABASE(this) with (this.DBASESAMPLES1) left = 14.0 width = 11.0 height = 1.0 databaseName = "DBASESAMPLES" active = true endwith this.EMPLOYEES1 = new QUERY(this) with (this.EMPLOYEES1) left = 4.0 width = 8.0 height = 1.0 database = form.dbasesamples1 sql = "select * from EMPLOYEES.DBF" active = true endwith this.EDITOR1 = new EDITOR(this) with (this.EDITOR1) height = 14.3636 left = 7.5714 top = 1.6364 width = 46.0 value = "" fontName = "Consolas" endwith this.ENTRYFIELD1 = new ENTRYFIELD(this) with (this.ENTRYFIELD1) height = 1.0 left = 33.2857 top = 18.0455 width = 15.7143 value = "employees.txt" endwith this.PUSHBUTTON1 = new PUSHBUTTON(this) with (this.PUSHBUTTON1) onClick = class::PUSHBUTTON1_ONCLICK height = 1.0909 left = 39.8571 top = 19.9545 width = 15.2857 text = "Print using Word" endwith this.PUSHBUTTON2 = new PUSHBUTTON(this) with (this.PUSHBUTTON2) onClick = class::PUSHBUTTON2_ONCLICK height = 1.0909 left = 2.7143 top = 19.9545 width = 15.2857 text = "Create list" endwith this.TEXTLABEL1 = new TEXTLABEL(this) with (this.TEXTLABEL1) height = 1.0 left = 33.8571 top = 16.7273 width = 12.0 text = "File name" endwith this.COMBOBOX1 = new COMBOBOX(this) with (this.COMBOBOX1) onChange = class::COMBOBOX1_ONCHANGE height = 1.0 left = 14.8571 top = 18.0455 width = 15.2857 style = 1 // DropDown endwith this.TEXTLABEL2 = new TEXTLABEL(this) with (this.TEXTLABEL2) height = 1.0 left = 18.8571 top = 16.7273 width = 12.0 text = "Order by" endwith this.rowset = this.employees1.rowset function COMBOBOX1_onChange() if this.value = 'No Index' form.employees1.rowset.indexname = '' else form.employees1.rowset.indexname = this.value endif return function PUSHBUTTON1_onClick() cFile = set('directory')+'\'+form.entryfield1.value oWord = new oleAutoclient("word.application") oWord.documents.open(cFile,false,true) oWord.activeDocument.printOut() oWord.quit( 0 ) release object oWord oWord = null return function PUSHBUTTON2_onClick() crlf = chr(13)+chr(10) if empty(form.entryfield1.value) msgbox('File name required','Error') return else f = new file() f.create(form.entryfield1.value) endif //reset the row pointer and empty editor display //Not needed for first list but required if the index is changed for a new list form.employees1.rowset.first() form.editor1.value = '' ferf = form.employees1.rowset.fields //"shortcut" to save typing in the loop do while not form.employees1.rowset.endofset cStr = trim(ferf['firstname'].value)+' '+trim(ferf['lastname'].value) cstr += space(25-len(cstr)) cStr += ferf['hiredate'].value f.puts(cStr) form.editor1.value += cStr+crlf form.employees1.rowset.next() enddo f.close() return function form_onOpen() //tableDef object has an array contining the available index names t=new TableDef() t.tableName=form.employees1.rowset.tablename t.load() //create new array with 'No Index' option form.indexNames = new array() form.indexNames.add('No Index') //add the indexes available for n = 1 to t.indexes.size form.indexNames.add(t.indexes[n].indexname) next //assign new array to combobox's datasource form.combobox1.datasource = 'array form.indexNames' return endclass