Ranorex

Exposing internal elements

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexNet
View previous topic :: View next topic  
Author Message
david_dawkins



Joined: 17 Mar 2007
Posts: 6

PostPosted: Sat Mar 17, 2007 8:19 pm    Post subject: Exposing internal elements
As the application developer, is there any way for me to expose the locations of items that we're drawing internally to the application? For example, we render meshes inside a Control, and we'd like to be able to click on them.

The only thing I can think of is to have some hidden control whose Text is the name and screen location of all the items we're drawing, and then to parse that text inside the Ranorex app. Is there a better way?

Thanks!
DavidD
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sat Mar 17, 2007 8:58 pm    Post subject:
david_dawkins wrote:
and we'd like to be able to click on them


If you know the location of the item (relative to the upper-left corner of the control) then you can use the ClickControl function:

Code: click into code to enlarge
Mouse.ClickControl(Control, ButtonType, Location)


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



Joined: 17 Mar 2007
Posts: 6

PostPosted: Sat Mar 17, 2007 9:17 pm    Post subject:
Thanks for your reply, but the point is that I don't know the location of the item. I need to query the application and have it tell me that the location is.

So, can you recommend a way for the application to expose this information so that we can read it from Ranorex?

I'm considering adding a SOAP interface to the app so that I can make the query, but I'd like your advice first.

FYI, the application is a 3D model editor, and the items I'd like to click on are items from the 3D world. When a model is loaded, the location of a particular object in the world will have an unpredictable location in terms of screen coords.

Thanks again.
DavidD
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Sun Mar 18, 2007 4:46 pm    Post subject:
david_dawkins wrote:
So, can you recommend a way for the application to expose this information so that we can read it from Ranorex?

My first suggestion:

You create dynamically an unvisible control object for every 3D model item and set the properties in the application:
(Code in your model editor application)

Code: click into code to enlarge
System.Windows.Forms.Control modelControl = new System.Windows.Forms.Control();
modelControl.Name = "modelControl";
modelControl.Text = "modelControl";
modelControl.Location = new Point(180, 200);
modelControl.Size = new Size(50, 60);
modelControl.CreateControl();
modelControl.Visible = false;
this.Controls.Add(modelControl);


You search the 3D model items in your test application with the function form.FindControlName and read the properties with Ranorex:
(Code in your test application)

Code: click into code to enlarge
Control modelControl = form.FindControlName("modelControl");
if (modelControl != null)
{
    Mouse.ClickControl(modelControl);
    Console.WriteLine("  Handle={0} Location={1} Text={2}",
            modelControl.Handle, modelControl.Location, modelControl.Text);
}


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 -> RanorexNet 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