/* TestGrid2.wfm This form creates a sample table, populates it with some dummy data, creates a couple of index tags, and then ... Is used to show the ease of changing column colors and fonts with the new dBASE Plus functionality of the grid ... This is part of the Knowledgebase for dBASE Plus, the paper on working with the grid. */ // check to see if table exists, if so, delete it, // and re-create it: close tables if file( "TestGridTable.dbf" ) drop table TestGridTable endif create table TestGridTable ; ( CustomerName char( 30 ),; CompanyName char( 20 ),; State char( 5 ) ) create index CustomerName on TestGridTable ( CustomerName ) create index CompanyName on TestGridTable ( CompanyName ) use TestGridTable append blank replace customername with "Smith, Fred", CompanyName with "Fred's Cookies", State with "CA" append blank replace customername with "Jones, John", CompanyName with "Superheroes, Ltd.", State with "NY" append blank replace customername with "Herbert, Frank", CompanyName with "Arrakis Enterprises", State with "ARRK" use ** END HEADER -- do not remove this line // // Generated on 04/01/2002 // parameter bModal local f f = new TestGrid2Form() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class TestGrid2Form of FORM with (this) onOpen = class::FORM_ONOPEN onDesignOpen = class::FORM_ONDESIGNOPEN height = 16 left = 38.8571 top = 3 width = 59.7143 text = "Grid Test 2" autoCenter = true endwith this.TESTGRIDTABLE1 = new QUERY() this.TESTGRIDTABLE1.parent = this with (this.TESTGRIDTABLE1) left = 1.2857 top = 4.5909 sql = 'select * from "TestGridTable.DBF"' active = true endwith with (this.TESTGRIDTABLE1.rowset) indexName = "COMPANYNAME" endwith this.TEXT1 = new TEXT(this) with (this.TEXT1) height = 2.9091 left = 2.4286 top = 0.4091 width = 57 text = "

This grid uses default colors, and default fonts, for all of the

columns, unless you click on the column headings, and some

of those will change the sort sequence, which changes the

colors ...

" endwith this.GRID1 = new GRID(this) with (this.GRID1) colorNormal = "white/blue" fontName = "Times New Roman" dataLink = form.testgridtable1.rowset columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1) columns["COLUMN1"].dataLink = form.testgridtable1.rowset.fields["customername"] columns["COLUMN1"].editorType = 1 // EntryField columns["COLUMN1"].width = 15.8571 columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1) columns["COLUMN2"].dataLink = form.testgridtable1.rowset.fields["companyname"] columns["COLUMN2"].editorType = 1 // EntryField columns["COLUMN2"].width = 24.5714 columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1) columns["COLUMN3"].dataLink = form.testgridtable1.rowset.fields["state"] columns["COLUMN3"].editorType = 1 // EntryField columns["COLUMN3"].width = 7.1429 with (columns["COLUMN1"].editorControl) colorNormal = "yellow/green" endwith with (columns["COLUMN1"].headingControl) onLeftMouseUp = class::HEADINGCONTROL_onLeftMouseUp value = "CustomerName" endwith with (columns["COLUMN2"].headingControl) onLeftMouseUp = class::HEADINGCONTROL_onLeftMouseUp1 value = "CompanyName" endwith with (columns["COLUMN3"].headingControl) value = "State" endwith bgColor = "blue" rowSelect = true colorRowSelect = "yellow/red" height = 11.2727 left = 4.8571 top = 3.5455 width = 53 endwith this.rowset = this.testgridtable1.rowset function form_onDesignOpen(bFromPalette) form.rowset.first() return function form_onOpen form.rowset.first() return function headingControl_onLeftMouseUp(flags, col, row) form.grid1.columns[2].editorControl.colorNormal := null // use grid default form.grid1.columns[1].editorControl.colorNormal := "yellow/green" form.rowset.indexName := "CustomerName" form.rowset.first() return function headingControl_onLeftMouseUp1(flags, col, row) form.grid1.columns[1].editorControl.colorNormal := null // use grid default form.grid1.columns[2].editorControl.colorNormal := "yellow/green" form.rowset.indexName := "CompanyName" form.rowset.first() return endclass