Thursday, 14 August 2014

USING CHECK BOX ENABLE / DISABLE RECORDS WITH THE GRID


Step 1:-

             Create a table and Add some  fields.

Step 2:-

            Add table as a data sources, Create a form.

Step 3:-

          Create a grid under design tab and add fields to the grid.

Step 4:-

           Add a check box to the form.

 Step 5:-



 Write the following code in modified method.

public Boolean modified()
{
boolean ret;
ret = super();
if(checkbox.value()==true)
{
while select CheckBoxTable
{
CheckBoxTable_ds.object(fieldnum(CheckBoxTable,Name)).visible(true);
CheckBoxTable_ds.object(fieldnum(CheckBoxTable,RegNo)).visible(true);
CheckBoxTable_ds.object(fieldnum(CheckBoxTable,Testbox)).visible(true);
}

}
else
{
while select RecId from CheckBoxTable where CheckBoxTable.TestBox == true
{
CheckBoxTable_ds.object(fieldnum(CheckBoxTable,RegNo)).visible(false);
CheckBoxTable_ds.object(fieldnum(CheckBoxTable,Testbox)).visible(false);
CheckBoxTable_ds.object(fieldnum(CheckBoxTable,Name)).visible(false);

}
}

CheckBoxTable_ds.refresh();
return ret;
}


Step 6:-

      Select the check box it will enables the grid.      



OUTPUT:-

       

         Un select the check box it disables the grid.





No comments:

Post a Comment