grid does not refresh

157 Views Asked by At

This is the code of the init of the form

if !used if !used ("supplier_temp")
   SELECT supplier
     afields(structure)
        CREATE cursor supplier_temp from array structure
else
     SELECT supplier_temp
         for re = 1 to reccount()
           SELECT supplier_temp
           go re
           _id = supplier_temp.id
           _name = supplier_temp.name
           _dir = supplier_temp.dir
           _cel = supplier_temp.cellphon
           _em = supplier_temp.email
            scan
           update provider set name=_name, address=_dir, cell=_cel, email = _em where control = 1 and id = _id
            end scan
         end for
    delete all
 endif
     SELECT supplier_temp
       APPEND FROM supplier for dispatched = 1
       GO TOP
       Thisform.Suppliers.RecordSource = "supplier_temp"
       Thisform.Suppliers.column1.ControlSource = "supplier_temp.name"
       Thisform.Proveedores.column2.ControlSource = "supplier_temp.direntre"
       Thisform.Proveedores.column3.ControlSource = "provider_temp.cellphon"
       Thisform.Suppliers.column4.ControlSource = "supplier_temp.email"

This is the code for the process button

If thisform.Proveedores.Column1.Check2.Value = 1
   thisform.Preclientes.column1.Check2.valid
    select supplier_temp
    go top
   replace supplier_temp.control with 2
    locate for supplier_temp.control = 2
      REPLACE supplier.control WITH supplier_temp.control for supplier.id = supplier_temp.id IN  supplier
    Thisform.Suppliers.refresh
    thisform.Suppliers.setfocus()
    thisform.refresh
endif

This is the code for the reject button

If thisform.Suppliers.Column1.Check2.Value = 1
  if !empty(suppliers_temp.obs)
    thisform.Suppliers.column1.Check2.valid
    select supplier_temp
    go top
    replace supplier_temp.control with 3
    locate for supplier_temp.control = 3
      REPLACE supplier.control WITH supplier_temp.control for supplier.id = supplier_temp.id IN  supplier
    Thisform.Suppliers.refresh
    thisform.Suppliers.setfocus()
    thisform.refresh
  endif
endif  

The grid is not refresh despite having in the init and in the buttons the commands Thisform.Suppliers.refresh,thisform.Suppliers.setfocus() and thisform.refresh. When the form is closed and reopened, the grid is refreshed

1

There are 1 best solutions below

1
Web Soft On

&& reset the grid control because init() executed twice

Thisform.Suppliers.RecordSource = ""

CREATE cursor supplier_temp from array structure

Thisform.Suppliers.RecordSource = "supplier_temp"