** END HEADER -- do not remove this line
//
// Generated on 07/06/2002
//
parameter bModal
local f
f = new testGrid3Form()
if (bModal)
   f.mdi = false // ensure not MDI
   f.readModal()
else
   f.open()
endif

class testGrid3Form of FORM
   with (this)
      onOpen = class::FORM_ONOPEN
      height = 16
      left = 17.4286
      top = 8.0909
      width = 70.4286
      text = "Grid Test 3"
   endwith

   this.DBASESAMPLES1 = new DATABASE()
   this.DBASESAMPLES1.parent = this
   with (this.DBASESAMPLES1)
      left = 43
      top = -0.0455
      databaseName = "DBASESAMPLES"
      active = true
   endwith

   this.FISH1 = new QUERY()
   this.FISH1.parent = this
   with (this.FISH1)
      left = 28
      top = -0.0455
      database = form.dbasesamples1
      sql = "select * from fish.dbf"
      active = true
   endwith

   with (this.FISH1.rowset)
      indexName = "ID"
   endwith

   this.RECTANGLE1 = new RECTANGLE(this)
   with (this.RECTANGLE1)
      left = 3
      top = 1.5
      width = 61
      height = 2.5
      text = "Sort by:"
   endwith

   this.GRID1 = new GRID(this)
   with (this.GRID1)
      colorNormal = "White/Blue"
      dataLink = form.fish1.rowset
      columns["COLUMN1"] = new GRIDCOLUMN(form.GRID1)
      columns["COLUMN1"].dataLink = form.fish1.rowset.fields["id"]
      columns["COLUMN1"].editorType = 1	// EntryField
      columns["COLUMN1"].width = 10.7143
      columns["COLUMN2"] = new GRIDCOLUMN(form.GRID1)
      columns["COLUMN2"].dataLink = form.fish1.rowset.fields["name"]
      columns["COLUMN2"].editorType = 1	// EntryField
      columns["COLUMN2"].width = 17.8571
      columns["COLUMN3"] = new GRIDCOLUMN(form.GRID1)
      columns["COLUMN3"].dataLink = form.fish1.rowset.fields["species"]
      columns["COLUMN3"].editorType = 1	// EntryField
      columns["COLUMN3"].width = 19.1429
      columns["COLUMN4"] = new GRIDCOLUMN(form.GRID1)
      columns["COLUMN4"].dataLink = form.fish1.rowset.fields["length cm"]
      columns["COLUMN4"].editorType = 1	// EntryField
      columns["COLUMN4"].width = 10.2857
      with (columns["COLUMN1"].headingControl)
         value = "ID"
      endwith

      with (columns["COLUMN2"].headingControl)
         value = "Name"
      endwith

      with (columns["COLUMN3"].headingControl)
         value = "Species"
      endwith

      with (columns["COLUMN4"].headingControl)
         value = "Length CM"
      endwith

      bgColor = "white"
      rowSelect = true
      height = 11
      left = 2
      top = 4.5
      width = 67
   endwith

   this.RBID = new RADIOBUTTON(this)
   with (this.RBID)
      onChange = class::GRIDSORT
      height = 1.0909
      left = 6
      top = 2.5
      width = 10
      text = "ID"
      group = true
      value = true
   endwith

   this.RBNAME = new RADIOBUTTON(this)
   with (this.RBNAME)
      onChange = class::GRIDSORT
      height = 1.0909
      left = 18
      top = 2.5
      width = 15.7143
      text = "Name"
   endwith

   this.RBSPECIES = new RADIOBUTTON(this)
   with (this.RBSPECIES)
      onChange = class::GRIDSORT
      height = 1.0909
      left = 36
      top = 2.5
      width = 15.7143
      text = "Species"
   endwith

   this.rowset = this.fish1.rowset

   function form_onOpen
      this.gridSort()
      return

procedure gridSort 
   // what to do when one of the radiobuttons is
   // selected:
   do case
      case form.rbid.value
           form.rowset.indexName = "ID"
           form.grid1.columns["Column1"].editorControl.colorNormal= "Yellow/Green"
           form.grid1.columns["Column2"].editorControl.colorNormal= "White/Blue"
           form.grid1.columns["Column3"].editorControl.colorNormal= "White/Blue"
      case form.rbname.value
           form.rowset.indexName = "NAME"
           form.grid1.columns["Column1"].editorControl.colorNormal= "White/Blue"
           form.grid1.columns["Column2"].editorControl.colorNormal= "Yellow/Green"
           form.grid1.columns["Column3"].editorControl.colorNormal= "White/Blue"
      case form.rbspecies.value
           form.rowset.indexName = "SPECIES"
           form.grid1.columns["Column1"].editorControl.colorNormal= "White/Blue"
           form.grid1.columns["Column2"].editorControl.colorNormal= "White/Blue"
           form.grid1.columns["Column3"].editorControl.colorNormal= "Yellow/Green"
   endcase
   form.rowset.first()
   form.grid1.columns["Column4"].editorControl.colorNormal= "White/Blue"
   return
endclass
