Enter a value in a textbox.

Class library usage, coding and language questions.
MaxDecimus
Posts: 2
Joined: Tue Oct 26, 2010 10:16 am

Enter a value in a textbox.

Post by MaxDecimus » Tue Oct 26, 2010 10:29 am

Hello, I have the following problem:
I’d like to enter a value in a textbox. That would normally be no problem, but I need to scroll down to the textbox. The scroll action is implemented and works. But instead of writing the value in the textbox, the scroll indicator jumps back, so that the textbox is invisible again. Ranorex doesn`t enter the value and doesn’t throw a RanorexException.

In an older Ranorex version (before 2.3), my program worked.

Code:
Text txtElement = new Text(absolutRanorexPath.ToString());
txtElement.DoubleClick();
Ranorex.Keyboard.Press(“123”);
Ranorex.Keyboard.Press(System.Windows.Forms.Keys.Return);

I tried to solve the problem with the Focus()-, EnsureVisible()- or MoveTo()-method, but without success.
Can anybody help me?

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Enter a value in a textbox.

Post by Ciege » Tue Oct 26, 2010 3:52 pm

If EnsureVisible isn't working for you then you can try checking the .visible state of the text box. If it is not visible then write some code yourself to scroll until it is visible. You can extend that to check what direction it needs to scroll (i.e. if is off left, or off down, etc..) then you can parameterize that method and make it a framework function that will ensure any object you want is visible and scrolled to.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: Enter a value in a textbox.

Post by Support Team » Tue Oct 26, 2010 9:33 pm

It seems like the EnsureVisible method is not working for that textbox control. Could you post a snapshot of the application or, even better, a sample application which we can reproduce the problem with?

Anyway, if you implemented the scroll action yourself, there is no need for using EnsureVisible. So I recommend setting the "Use Ensure Visible" property of the repository item or adapter for that textbox to "false". That way Ranorex will not try to make the textbox visible - which seems to fail by scrolling the container to a wrong position.

Regards,
Alex
Ranorex Team
.
Image

MaxDecimus
Posts: 2
Joined: Tue Oct 26, 2010 10:16 am

Re: Enter a value in a textbox.

Post by MaxDecimus » Thu Oct 28, 2010 12:33 pm

Thank you for responding so quickly. Sadly, it still doesn`t work.
...Alex could you send me your email address? I thnik this will be the best way.

Best regards

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

Re: Enter a value in a textbox.

Post by Support Team » Thu Oct 28, 2010 1:23 pm

Just sent us an email to [email protected]

Regards,
Peter
Ranorex Team
.
Image