Ranorex DataGridView: no ReadOnly, but has IsReadOnly?

Ask general questions here.
LPG
Posts: 39
Joined: Mon Jul 25, 2011 6:12 pm

Ranorex DataGridView: no ReadOnly, but has IsReadOnly?

Post by LPG » Mon Aug 01, 2011 6: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;
      foreach (Ranorex.Cell myCell in myRow.Cells)
      {
         int mmIndex = myCell.Element.ChildIndex;
         
         // ----------- Check if cells are ReadOnly -----------
         if (repo.MyForm.TestFolder.MyGrid.Rows.Cells[mmIndex].Enabled == true)
         {
            if (repo.MyForm.TestFolder.MyGrid.Rows.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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

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

Post by Support Team » Tue Aug 02, 2011 9: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
.
Image

LPG
Posts: 39
Joined: Mon Jul 25, 2011 6:12 pm

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

Post by LPG » Tue Aug 02, 2011 2:45 pm

I have sent the information to the Support email address. Thanks.