Ranorex DataGridView: no ReadOnly, but has IsReadOnly? : General Questions

Ranorex DataGridView: no ReadOnly, but has IsReadOnly?

Ask general questions here.

Ranorex DataGridView: no ReadOnly, but has IsReadOnly?

Postby LPG » Mon Aug 01, 2011 7:46 pm

I am trying to verify that all cells of a table (DataGridView) are ReadOnly. I am unable to get "ReadOnly" as an option for the cells of the repository grid. It does have "IsReadOnly" available though. Is this expected, or am I missing something? I just would have thought that it would have exactly the same attributes as the .NET object. For a text field, I can use "ReadOnly" just fine.

Also, I am unable to use this IsReadOnly attribute in a Validate statement. When I use the common "ReadOnly" attribute in a validate statement for a TEXT field, it works fine. But for "IsReadOnly", I get an error.

Below is a sample of how I was able to use "IsReadOnly". It works if I use it this way, I'm just not sure if this is the best way to get to the same result.

public void CheckEditableFields()
{
   Ranorex.Table myTable = repo.MyForm.TestFolder.MyGrid;
   
   for (int i = 1; i < myTable.Rows.Count; i++)
   {
      Ranorex.Row myRow = repo.MyForm.TestFolder.MyGrid.Rows[i];
      foreach (Ranorex.Cell myCell in myRow.Cells)
      {
         int mmIndex = myCell.Element.ChildIndex;
         
         // ----------- Check if cells are ReadOnly -----------
         if (repo.MyForm.TestFolder.MyGrid.Rows[i].Cells[mmIndex].Enabled == true)
         {
            if (repo.MyForm.TestFolder.MyGrid.Rows[i].Cells[mmIndex].Element.Attributes.IsReadOnly == false)
            {
               Report.Info("Success:  cell is Editable");
            }
            else
            {
               Report.Failure("Failure: cell is ReadOnly.");
            }
         }
         else
         {
            Report.Failure("Failure:  cell is Disabled.");
         }
      }
   }
}

Thanks
LPG
 
Posts: 25
Joined: Mon Jul 25, 2011 7:12 pm

Re: Ranorex DataGridView: no ReadOnly, but has IsReadOnly?

Postby Support Team » Tue Aug 02, 2011 10:51 am

Hi,

Please could you post us a Ranorex Snapshot of the DataGrid for further analyzes? With this snapshot we can rebuild an executable and try your code above. If your DataGrid is a WPF DataGrid it should be possible to use the IsReadOnly property. Therefore please take a look to following documentation
http://www.ranorex.com/Documentation/Ra ... adOnly.htm

Regards,
Peter
Ranorex Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Ranorex DataGridView: no ReadOnly, but has IsReadOnly?

Postby LPG » Tue Aug 02, 2011 3:45 pm

I have sent the information to the Support email address. Thanks.
LPG
 
Posts: 25
Joined: Mon Jul 25, 2011 7:12 pm


Return to General Questions

Who is online

Users browsing this forum: No registered users and 1 guest