| View previous topic :: View next topic |
| Author |
Message |
jabelshauser
Joined: 23 Aug 2007 Posts: 16
|
Posted: Thu Sep 13, 2007 2:15 pm Post subject: Bug in table-cell editing |
|
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 |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Sat Sep 15, 2007 8:47 am Post subject: |
|
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: click into code to enlarge
// 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 |
|
| Back to top |
|
 |
jabelshauser
Joined: 23 Aug 2007 Posts: 16
|
Posted: Mon Sep 17, 2007 3:05 pm Post subject: |
|
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 ??? |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Mon Sep 17, 2007 10:59 pm Post subject: |
|
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 |
|
| Back to top |
|
 |
jabelshauser
Joined: 23 Aug 2007 Posts: 16
|
Posted: Tue Sep 18, 2007 7:42 am Post subject: |
|
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: click into code to enlarge
//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!");
}
}
|
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Tue Sep 18, 2007 11:55 am Post subject: |
|
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 |
|
| Back to top |
|
 |
jabelshauser
Joined: 23 Aug 2007 Posts: 16
|
Posted: Tue Sep 18, 2007 12:05 pm Post subject: |
|
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 ? |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Tue Sep 18, 2007 1:23 pm Post subject: |
|
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: click into code to enlarge
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 |
|
| Back to top |
|
 |
jabelshauser
Joined: 23 Aug 2007 Posts: 16
|
Posted: Tue Sep 18, 2007 2:24 pm Post subject: |
|
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 |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Tue Sep 18, 2007 9:36 pm Post subject: |
|
| Quote: |
| ...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 |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Thu Sep 20, 2007 12:28 pm Post subject: |
|
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: click into code to enlarge
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 |
|
| Back to top |
|
 |
jabelshauser
Joined: 23 Aug 2007 Posts: 16
|
Posted: Thu Sep 20, 2007 2:21 pm Post subject: |
|
| ok, with this workaround the bug is fixed |
|
| Back to top |
|
 |
|