EnsureVisible does not work

Ask general questions here.
sivakumaran
Posts: 20
Joined: Fri Dec 18, 2015 8:07 am

EnsureVisible does not work

Post by sivakumaran » Wed Jan 13, 2016 9:52 am

Hello experts,

I have an editor that hosts grid control. that displays data in a tree format, some controls become visible only expanding certain nodes.
no matter it is tree or not
let's say I have a control that is not in the visible area of the editor.
so I used EnsureVisible on that control, thinking that it will make sure to bring the control to focus by auto scrolling or so.
but it did not work that way.

so I wrote a code method to check the visible (Accessible property of that control) from false to true. Until then I scroll right or bottom.

But the scrolling itself is time consuming and very slow.
the code is as below,

void ITestModule.Run()
{
...
Text fG1Line1 = repo.ApplicationFrame.fG1Line1IdentificationTextInfo.CreateAdapter<Text>(false);
MakeVisible(fG1Line1);
fG1Line1.DoubleClick();
Delay.Milliseconds(200);
...
....
}

void MakeVisible(Text text)
{
bool isVisible = text.Visible;
while(isVisible == false)
{
repo.ApplicationFrame.PageDown.Click();
Delay.Milliseconds(200);

isVisible = text.Visible;
}
repo.ApplicationFrame.LineDown.Click();
Delay.Milliseconds(200);
}

can somebody suggest a better alternative to this issue?

best regards,
Siva

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3925
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: EnsureVisible does not work

Post by odklizec » Wed Jan 13, 2016 10:35 am

Hi Siva,

Could you please upload a Ranorex snapshot of the problematic control and also the example of code you tried with EnsureVisible?

I'm using EnsureVisible regularly (to bring controls outside the visible area of screen to visible area) and it works quite well. So your problem sounds either like a problem with code or control-specific issue?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration