Ranorex

Missing GetFocus() method

 
Post new topic   Reply to topic    Ranorex Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
Gryphyn



Joined: 07 Dec 2006
Posts: 15

PostPosted: Wed Jun 27, 2007 12:53 am    Post subject: Missing GetFocus() method
xPost

Ranorex 1.2
.Net 2.0

I've just upgraded to Ranorex 1.2
When I go to recompile I get an error for every instance of
"Control <control> = <Form>.GetFocus()"

Investigation shows that this method is missing from the latest release.
Crying or Very sad

Cheers
Gryphyn
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Wed Jun 27, 2007 10:51 pm    Post subject:
Quote:
Investigation shows that this method is missing from the latest release.


I tried the following code with the VS2005Application.exe and it worked for me:

Code: click into code to enlarge
for (int i = 0; i < 60; i++)
{
    Control control = Form.GetFocus();
    Console.WriteLine("Control = {0}", control.GetType());
    Application.Sleep(1000);
}


GetFocus is a static method, please use Form.GetFocus() and not an instance object.

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Gryphyn



Joined: 07 Dec 2006
Posts: 15

PostPosted: Thu Jun 28, 2007 1:37 am    Post subject:
OK.
The method is not missing, it's changed to a static method.
--Intellisense couldn't/can't find it.

but this is still a change from previous versions where GetFocus() was a valid method for any Form object.

This now means that my code needs to bring the appropriate FORM into focus, before checking which CONTROL is in focus. (I'm assuming the static method is using the focused FORM)

-- off to branch my code stream --
(old code needs to compile against earlier Ranorex versions.)

A simple upgrade got awfully messy...

Cheers
Gryphyn
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Thu Jun 28, 2007 11:12 pm    Post subject:
Quote:
This now means that my code needs to bring the appropriate FORM into focus, before checking which CONTROL is in focus. (I'm assuming the static method is using the focused FORM)


GetFocus attaches to the currently activ form and returns the control that has the keyboard focus.
I checked the version history in Subversion. The function seems to be the same except that the function is static.

Sorry for the inconvenience.

Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> Bug Reports All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum