| View previous topic :: View next topic |
| Author |
Message |
RG@CSG
Joined: 24 Nov 2006 Posts: 2 Location: Italy - Ivrea
|
Posted: Fri Nov 24, 2006 4:06 pm Post subject: State of a window |
|
Hi,
I've found a problem working with a window belonging an application of mine written in C++.NET; so I'm using RanorexNet.dll
I got the element of the window this way:
Code: click into code to enlarge
pSubWindow = pForm->Element->FindChild( Ranorex::Role::Client, "XXX" );
pButtonEl = pSubWindow->FindChild( Ranorex::Role::PushButton, "Save" );
Then i use it:
First time I enter this piece of code everything works ok and the pSubWindow->State is set to Focusable. Then I hide this window, show it and I got pSubWindow->State set to Invisible and the pSubWindow->GetChildCount is set to zero, the pButtonEl results undefined.
What's wrong? Please help |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Sun Nov 26, 2006 6:54 pm Post subject: |
|
I couldn't reproduce this issue with some sample applications, it's possible, that your window will be destroyed and new created.
If so, then it gets a new handle and you can't use the old object references, you must find the form and the element again after the show operation.
This can happen with some .NET Framework 2.0 controls.
Please try it and inform me about the results.
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
RG@CSG
Joined: 24 Nov 2006 Posts: 2 Location: Italy - Ivrea
|
Posted: Mon Nov 27, 2006 10:41 am Post subject: State of a window |
|
Hi Jenö,
here I post some code hoping it could help:
Code: click into code to enlarge
pToolStripEl = pControl->Element->FindChild( Ranorex::Role::ToolBar, "toolStrip1" );
nIndex = 0;
pButtonEl = nullptr;
while ( pElement = pTableElement->FindChild( Ranorex::Role::RowHeader, String::Format( "Row {0}", nIndex ) ) )
{
// Click the row
Mouse::ClickElement( pElement );
// Click on the modify button
Mouse::ClickElement( pToolStripEl->GetChild( 1 ) );
{
Application::Sleep( 1000 );
pSubWindow = pForm->Element->FindChild( Ranorex::Role::Client, "Articles" );
//pSubWindow = pForm->Element->FindChild( Ranorex::Role::Window, "Articles" );
Trace( "Window state: {0}", pSubWindow->State );
} while ( pSubWindow == nullptr && nTries-- );
// Click on save
pButtonEl = pSubWindow->FindChild( Ranorex::Role::PushButton, "Save" );
Mouse::ClickElement( pButtonEl );
nIndex++;
}
Even if the window is destroyed, it's catched again. But the state is wrong.
I'm working with .NET 2.0.50727
Thanks for your hints, wish your well,
Roberto |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Tue Nov 28, 2006 9:11 am Post subject: |
|
The problem is, that i don't know what your application exactly do. Can you send us please a simple application and your managed C++ test code.
We will debug it and send you the results.
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
|