Ranorex

DoDefaultAction and Modal Dialog

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



Joined: 02 Oct 2007
Posts: 7

PostPosted: Fri Oct 12, 2007 7:30 pm    Post subject: DoDefaultAction and Modal Dialog
I'm trying to automate a modal dialog that opens a file. I've tried doing this using the following code:

Code: click into code to enlarge

        public void FileOpen_Menu(String fileName, Boolean open)
        {

            Element item = mainMenu.Element.FindChild(Role.MenuItem, "File Open");
 
            if (item != null && item.State != State.Unavailable)
            {
                item.DoDefaultAction();
                Application.Sleep(2000);
                Control openDialog = Application.FindFormTitle("Open Diagram");
                Element textBox = openDialog.Element.FindChild(Role.Text, "File name:");
                textBox.Value = fileName;
                Element btn;
                if (open)
                    btn = openDialog.Element.FindChild(Role.PushButton, "Open", "Button");
                else
                    btn = openDialog.Element.FindChild(Role.PushButton, "Cancel", "Button");
                Mouse.ClickElement(btn);
            }
        }


The dialog opens and the execution hangs on DoDefaultAction(). However, if I replace item.DoDefaultAction(); with Application.SendKeys("^o");, everything works as expected.

Is this the expected behavior for DoDefaultAction()? I am using the trial version.

Thanks in advance for your help.

ChrisC
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 435

PostPosted: Mon Oct 15, 2007 2:58 pm    Post subject:
Quote:
... if I replace item.DoDefaultAction(); with Application.SendKeys("^o");, everything works as expected.

Is this the expected behavior for DoDefaultAction()?


No, DoDefaultAction() should work.
Unfortunately some user controls does not support all accessibility functions.

You have to find a workaround (e.g. with SendKeys) for such an issue.

Jenö
Ranorex Support 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