Bug in table-cell editing

Bug reports.
jabelshauser
Posts: 55
Joined: Thu Aug 23, 2007 12:00 pm

Bug in table-cell editing

Post by jabelshauser » Thu Sep 13, 2007 1:15 pm

1st time table-cell -> DoDefaultAction -> Extends: cell.client.text =ok
2nd time same table-cell DoDefaultAction -> Extends: cell.client, text isn't available.
With Ranorex-Spy or other MSAA-Tool, the text is available
Can be a Bug in the Ranorex-lib, accesses previous Elements ?

regards
Jörg

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Sat Sep 15, 2007 7:47 am

I couldn't reproduce this issue with the Microsoft DataGridView Control sample.
You can download the sample application from:

http://msdn2.microsoft.com/en-us/library/1x64c23x.aspx

The following code works for me:

Code: Select all

// Find the element by name
Element contactRow7 = dataGridView1.Element.FindChild(Role.Cell, "Contact Name Row 7");
if (contactRow7 != null)
{
    contactRow7.Value = "Ranorex";

    // DoDefaultAction, wait 10 sec and read the text
    for (int i = 0; i < 10; i++)
    {

        bool ddaRet = contactRow7.DoDefaultAction();
        Application.Sleep(10000);
        Console.WriteLine("DoDefaultAction ret={0}   Text = {1}",
                                        ddaRet, contactRow7.Value);

    }
}
Jenö
Ranorex Team

jabelshauser
Posts: 55
Joined: Thu Aug 23, 2007 12:00 pm

Post by jabelshauser » Mon Sep 17, 2007 2:05 pm

the effect occurs with a Xceed-gridcontrol, when i complete a Value-Set with a
Sendkeys("{ENTER}"). If i don't complete, the value isn't be set in the cell.
The problem is, that a Xceed-cell extends itself when i execute DoDefaultAction at the cell to a subchild-structur like: cell-cleint-window-text, and only this last text can be edited.

What can i do else to complete a Value-Set ? I think there should be a mechanism like "CompleteDefaultAction" after setting the Value in the underlying (and temporaer) Text-Child, to transfer this new value in the cell-Value.

Or i am completely wrong ???

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Mon Sep 17, 2007 9:59 pm

I checked the XCeed-gridcontrol with the XceedGridLiveExplorer.exe. I think not all elements of the grid control supports accessibility. Please post me the steps i need to reproduce this issue with the XceedGridLiveExplorer.exe.
(I realised that in some cases you cannot complete an edit operation with Enter, but with the TAB key.)

Jenö
Ranorex Team

jabelshauser
Posts: 55
Joined: Thu Aug 23, 2007 12:00 pm

Post by jabelshauser » Tue Sep 18, 2007 6:42 am

The variant a is ok, but i won't edit the table-cell with mouse-clicks and not with SendKeys, because while debugging it appears that the focus changes to visual-studio and the mouse/sendkey-actions will be executed in this and not in the test-form.
In variant b, the 1st time is ok and the Exception occurs at the 2nd-time, then no editable text is found.

the used gridcontrol is a Exceed-gridcontrol

Code: Select all

//variant a) ok
			for(int i=1; i<10; i++)
			{			
				Element e_ = f1.FindControlName("gridControl1").Element.FindChild(Role.Table);
				Element el = e_.GetChild(3).GetChild(2);	//get a cell
				
				Mouse.ClickElement(el);
				Application.SendKeys(Convert.ToString(i) + "{ENTER}");
			}

//variant b) nok
			for(int i=1; i<10; i++)
			{			
				Element e_ = f1.FindControlName("gridControl1").Element.FindChild(Role.Table);
				Element el = e_.GetChild(3).GetChild(2);	//get a cell
				
				el.DoDefaultAction();	//Edit
	
				// get the editable text-element
				if(el.GetChild(0).ChildCount >= 1)
				{					
					Element el_ = el.GetChild(0).FindChild(Role.Text);					
					el_.Value = Convert.ToString(i);				
					Application.SendKeys("{TAB}");
				}	
				else
				{
					throw new Exception("No Edit-Element available!");
				}
			}

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Tue Sep 18, 2007 10:55 am

It can also be a timing problem, the tested application runs in an other process.
Please try to wait a little bit after DoDefaultAction(), to create an edit control takes some time.

el.DoDefaultAction(); //Edit
Application.Sleep(500);

Jenö
Ranorex Team

jabelshauser
Posts: 55
Joined: Thu Aug 23, 2007 12:00 pm

Post by jabelshauser » Tue Sep 18, 2007 11:05 am

no, i have already checked the time-behaviour, it has no effect.

Now i have another behaviour with (perhaps) same cause:
If i have read the child of a client 1 time, and a value-change happens, a new read returns the old value again. AccExplorer reads the correct (new) value after refresh.
- Here again: i guess, that i access old/obsolete elements the 2nd time
- Is there a refresh available in Ranorex ?

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Tue Sep 18, 2007 12:23 pm

It can be a bug, but we cannot reproduce it with Microsoft controls or applications.

I tried the following code with the Microsoft DataGridView Control sample:

You can download the sample application from:
http://msdn2.microsoft.com/en-us/library/1x64c23x.aspx

Code: Select all

Control dataGridView1 = form.FindControlName("dataGridView1");
if (dataGridView1 == null)
{
    Console.WriteLine("ERROR: dataGridView1 not found ");
    return 1;
}

// Find the element by name
Element contactRow7 = dataGridView1.Element.FindChild(Role.Cell, "Contact Name Row 7");
if (contactRow7 != null)
{
    for (int i = 0; i < 30; i++)
    {
        Application.Sleep(1000);
        Console.WriteLine("Cell Value = {0}", contactRow7.Value);
    }
}
Please send us a sample application with the test sources or post us the steps we need to reproduce the bug with a Microsoft application like Microsoft DataGridView Control sample.

Jenö
Ranorex Team

jabelshauser
Posts: 55
Joined: Thu Aug 23, 2007 12:00 pm

Post by jabelshauser » Tue Sep 18, 2007 1:24 pm

The grid-code is the snippet above variant b), evaluated with a Xceed-gridcontrol. With this code, i can produce the behaviour.

the new behaviour (post 11:05) is the access to an AccessibleObject. Unfortunately, this code is to complex to send to you.

regards
Jörg Abelshauser

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Tue Sep 18, 2007 8:36 pm

...evaluated with a Xceed-gridcontrol. With this code, i can produce the behaviour
I tried to reproduce this issue with the Xceed-gridcontrol samples Validation, MasterDetail or LiveExplorer but i couldn't.

How can i reproduce the problem with the Xceed samples?

Jenö
Ranorex Team

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Thu Sep 20, 2007 11:28 am

It seems to be a problem in the Element cache functions, we will check this issue for the next version.
Please use the following workaround in V1.2:

1. Generate a textfile with the name Ranorex.ini
2. Insert the following text:

[General]
ElementCacheSize=4

3. Copy the file into the Ranorex Bin directory (RanorexCore.dll must be in the same directory).

After setting the new value, you must send an Enter with SendKeys or change the cell with DoDefaultAction:

Code: Select all

for (int i = 1; i < 10; i++)
{
    Element e_ = f1.FindControlName("gridControl1").Element.FindChild(Role.Table);
    Element el = e_.GetChild(3).GetChild(1);	//get a cell
    Element el2 = e_.GetChild(3).GetChild(2);

    el.DoDefaultAction();	//Edit

    Element el_ = el.FindChild(Role.Text);
    if (el_ != null)
    {
        string newval = Convert.ToString(DateTime.Now.Millisecond);
        el_.Value = newval;
        el2.DoDefaultAction();	// Change the cell

        if (el.Value != newval)
        {
            throw new Exception("Value not comitted !");
        }
        else
            Console.WriteLine("Value={0} OK",newval);
    }
    else
    {
        throw new Exception("No Editable Text available!");
    }
}
Jenö
Ranorex Team

jabelshauser
Posts: 55
Joined: Thu Aug 23, 2007 12:00 pm

Post by jabelshauser » Thu Sep 20, 2007 1:21 pm

ok, with this workaround the bug is fixed